diff options
author | Andrea Weikert <elubie@gmx.net> | 2006-09-16 15:42:37 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2006-09-16 15:42:37 +0400 |
commit | 5277232d4264e68141c973d80b836a1482a86421 (patch) | |
tree | 05492beed292271f8bf9ea20e792f07cdf21c6c9 /source | |
parent | b150f25c36eba0091a3159fed5eab265634a3f4c (diff) |
FIX: [ #4944 ] Shift F4 menu folders are freezed
- code for adding 'c:\' on Windows missed fact that BLI_convertstringcode is also used for databrowse.
- now only replacing when path starts with '/', which isn't the case with databrowse
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/util.c | 23 | ||||
-rw-r--r-- | source/blender/src/filesel.c | 9 |
2 files changed, 23 insertions, 9 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 1ef9c5c8cda..28831018fa1 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -817,20 +817,27 @@ void BLI_makestringcode(const char *relfile, char *file) int BLI_convertstringcode(char *path, const char *basepath, int framenum) { - int len, wasrelative; + int len, wasrelative, is_filepath; char tmp[FILE_MAXDIR+FILE_MAXFILE]; char base[FILE_MAXDIR]; - - wasrelative= (strncmp(path, "//", 2)==0); + char vol[3] = {'\0', '\0', '\0'}; + + BLI_strncpy(vol, path, 2); + wasrelative= (strncmp(vol, "//", 2)==0); #ifdef WIN32 - if (!wasrelative && path[1] != ':') { + /* we are checking here if we have an absolute path that is not in the current + blend file as a lib main - we are basically checking for the case that a + UNIX root '/' is passed. + */ + if (!wasrelative && (vol[1] != ':' && (vol[0] == '\0' || vol[0] == '/' || vol[0] == '\\'))) { + char *p = path; get_default_root(tmp); // get rid of the slashes at the beginning of the path - while (*path == '\\' || *path == '/') { - path++; + while (*p == '\\' || *p == '/') { + p++; } - strcat(tmp, path); + strcat(tmp, p); } else { strcpy(tmp, path); @@ -870,7 +877,7 @@ int BLI_convertstringcode(char *path, const char *basepath, int framenum) if(len && tmp[len-1]=='#') { sprintf(tmp+len-1, "%04d", framenum); } - + strcpy(path, tmp); #ifdef WIN32 /* skip first two chars, which in case of diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index aed282e60e1..86e8cdfdc81 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -1249,7 +1249,7 @@ void activate_fileselect(int type, char *title, char *file, void (*func)(char *) sfile->ofs= 0; /* sfile->act is used for databrowse: double names of library objects */ sfile->act= -1; - + if(BLI_convertstringcode(name, G.sce, G.scene->r.cfra)) sfile->flag |= FILE_STRINGCODE; else sfile->flag &= ~FILE_STRINGCODE; @@ -1462,6 +1462,13 @@ static void filesel_execute(SpaceFile *sfile) filesel_prevspace(); if(sfile->type==FILE_LOADLIB) { + if(sfile->flag & FILE_STRINGCODE) { + if (!G.relbase_valid) { + okee("You have to save the .blend file before using relative paths! Using absolute path instead."); + sfile->flag &= ~FILE_STRINGCODE; + } + } + do_library_append(sfile); BIF_undo_push("Append from file"); allqueue(REDRAWALL, 1); |