Get export directory for Windows
This commit is contained in:
parent
bbf795209d
commit
31fa1af9a5
3 changed files with 30 additions and 3 deletions
|
|
@ -63,9 +63,10 @@ new_trie(int degree, int *nkeys)
|
|||
static void
|
||||
del_trie(Node *root, int degree)
|
||||
{
|
||||
int i;
|
||||
if (!root)
|
||||
return;
|
||||
for (int i = 0; i < degree; i++)
|
||||
for (i = 0; i < degree; i++)
|
||||
del_trie(root->children[i], degree);
|
||||
free(root);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1319,7 +1319,9 @@ static void handle_motioners(int oldpos_x, int oldpos_y, int motioner, int hatmo
|
|||
static void handle_joybuttonupdownscl(SDL_Event event, int oldpos_x, int oldpos_y, SDL_Rect real_r_tools);
|
||||
|
||||
char * get_xdg_user_dir(const char * dir_type, const char * fallback);
|
||||
|
||||
#ifdef WIN32
|
||||
extern char * GetUserImageDir(void);
|
||||
#endif
|
||||
|
||||
/* Magic tools API and tool handles: */
|
||||
|
||||
|
|
@ -22843,12 +22845,15 @@ static void setup_config(char *argv[])
|
|||
else
|
||||
{
|
||||
/* FIXME: Need assist for:
|
||||
* _WIN32
|
||||
* __BEOS__
|
||||
* __HAIKU__
|
||||
* __APPLE__
|
||||
*/
|
||||
#ifdef WIN32
|
||||
picturesdir = GetUserImageDir();
|
||||
#else
|
||||
picturesdir = get_xdg_user_dir("PICTURES", "Pictures");
|
||||
#endif
|
||||
safe_snprintf(str, sizeof(str), "%s/TuxPaint", picturesdir);
|
||||
free(picturesdir);
|
||||
exportdir = strdup(str);
|
||||
|
|
|
|||
|
|
@ -597,6 +597,27 @@ char *GetSystemFontDir(void)
|
|||
return strdup("C:\\WINDOWS\\FONTS");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns heap string containing user's image directory.
|
||||
*
|
||||
* @return user's image dir
|
||||
*/
|
||||
char *GetUserImageDir(void)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
const char *key = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
const char *option = "My Pictures";
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (SUCCEEDED(hr = ReadRegistry(key, option, path, sizeof(path))))
|
||||
{
|
||||
remove_slash(path);
|
||||
return strdup(path);
|
||||
}
|
||||
return strdup("C:\\Pictures");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns heap string containing user temp directory.
|
||||
E.g. C:\Documents and Settings\jfp\Local Settings\Temp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue