[sword-devel] APPDATA / ALLUSERSPROFILE
Troy A. Griffitts
scribe at crosswire.org
Sun Apr 26 06:41:02 MST 2009
Matthew Talbert wrote:
> There is a way to do this, but it's not easy (bad Microsoft). My
> recommendation is to leave ALLUSERPROFILE/Application Data as it is
> for now,
Cool, thanks for that. Before I sent the previous email I did a quick
scan of the env variables and couldn't find anything that looked close,
but wanted to first tap your extended knowledge on this subject before
hard coding the "Application Data" string. Now I will hack it in with a
clear conscience. Appreciate the answer.
-Troy.
because it works in the greatest number of cases (it should
> actually work on localized installs, though it's obviously not
> preferred). When the NTFS stuff is fixed, that would be a good time to
> do it correctly. An implementation of the correct method is below
> (obviously stolen from glib). Without fixing the Unicode/NTFS issue,
> there's no guarantee that the correct location will actually be usable
> (the same goes for BibleCS's Program Files location).
>
> Matthew
>
>
> #define CSIDL_COMMON_APPDATA = 35;
>
> p = get_special_folder (CSIDL_COMMON_APPDATA);
>
> get_special_folder (int csidl)
> {
> union {
> char c[MAX_PATH+1];
> wchar_t wc[MAX_PATH+1];
> } path;
> HRESULT hr;
> LPITEMIDLIST pidl = NULL;
> BOOL b;
> gchar *retval = NULL;
>
> hr = SHGetSpecialFolderLocation (NULL, csidl, &pidl);
> if (hr == S_OK)
> {
> if (G_WIN32_HAVE_WIDECHAR_API ())
> {
> b = SHGetPathFromIDListW (pidl, path.wc);
> if (b)
> retval = g_utf16_to_utf8 (path.wc, -1, NULL, NULL, NULL);
> }
> else
> {
> b = SHGetPathFromIDListA (pidl, path.c);
> if (b)
> retval = g_locale_to_utf8 (path.c, -1, NULL, NULL, NULL);
> }
> CoTaskMemFree (pidl);
> }
> return retval;
> }
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
More information about the sword-devel
mailing list