Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-03-02 03:26:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-03-02 03:26:13 +0300
commit2b7e99da69be5e861bdf6ea808bedf9fd8b161bc (patch)
treebba18b50690fffd824a3fbac31302e1bc40d5dc4 /source/blender/src/filesel.c
parent0db0f5734d358676b11eccc702cf02adb3174b7e (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/filesel.c')
-rw-r--r--source/blender/src/filesel.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 1d3568df703..1262683b90a 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -1529,12 +1529,19 @@ static void do_filesel_buttons(short event, SpaceFile *sfile)
else if(event== B_FS_DIRNAME) {
/* reuse the butname variable */
-#ifndef WIN32
- /* convienence shortcut '~' -> $HOME */
- if ( sfile->dir[0] == '~' && sfile->dir[1] == '\0' ) {
- BLI_strncpy(sfile->dir, BLI_gethome(), sizeof(sfile->dir) );
+ /* convienence shortcut '~' -> $HOME
+ * If the first char is ~ then this is invalid on all OS's so its safe to replace with home */
+ if ( sfile->dir[0] == '~' ) {
+ if (sfile->dir[1] == '\0') {
+ BLI_strncpy(sfile->dir, BLI_gethome(), sizeof(sfile->dir) );
+ } else {
+ /* replace ~ with home */
+ char tmpstr[FILE_MAX];
+ BLI_join_dirfile(tmpstr, BLI_gethome(), sfile->dir+1);
+ BLI_strncpy(sfile->dir, tmpstr, sizeof(sfile->dir));
+ }
}
-#endif
+
BLI_cleanup_dir(G.sce, sfile->dir);
BLI_make_file_string(G.sce, butname, sfile->dir, "");