diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-03-02 03:26:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-03-02 03:26:13 +0300 |
commit | 2b7e99da69be5e861bdf6ea808bedf9fd8b161bc (patch) | |
tree | bba18b50690fffd824a3fbac31302e1bc40d5dc4 /source/blender/src/editimasel.c | |
parent | 0db0f5734d358676b11eccc702cf02adb3174b7e (diff) |
made it possible to type in ~ at the start of the filename, ~/Desktop for instance.
Enabled for win32 and in the image browser.
Diffstat (limited to 'source/blender/src/editimasel.c')
-rw-r--r-- | source/blender/src/editimasel.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c index 30f7d7f93c9..f3e2dcccc81 100644 --- a/source/blender/src/editimasel.c +++ b/source/blender/src/editimasel.c @@ -594,7 +594,21 @@ static void do_imasel_buttons(short event, SpaceImaSel *simasel) } } else if(event== B_FS_DIRNAME) { - /* reuse the butname variable */ + + /* convienence shortcut '~' -> $HOME + * If the first char is ~ then this is invalid on all OS's so its safe to replace with home */ + if ( simasel->dir[0] == '~' ) { + if (simasel->dir[1] == '\0') { + BLI_strncpy(simasel->dir, BLI_gethome(), sizeof(simasel->dir) ); + } else { + /* replace ~ with home */ + char tmpstr[FILE_MAX]; + BLI_join_dirfile(tmpstr, BLI_gethome(), simasel->dir+1); + BLI_strncpy(simasel->dir, tmpstr, sizeof(simasel->dir)); + } + } + + /* reuse the butname vsariable */ BLI_cleanup_dir(G.sce, simasel->dir); BLI_make_file_string(G.sce, butname, simasel->dir, ""); |