X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;ds=sidebyside;f=cinelerra-5.1%2Fguicast%2Ffilesystem.C;h=86544cc64fa6982502f463ecd5a500733fc1fd59;hb=58d99c74e65066486dbebf7e1cb3087e7de1c92b;hp=50c38a1c14c1c76dbab0a38c5edf09205c9c5fa3;hpb=43821d27c5b51c4250a251f20c98878f54deb288;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C index 50c38a1c..86544cc6 100644 --- a/cinelerra-5.1/guicast/filesystem.C +++ b/cinelerra-5.1/guicast/filesystem.C @@ -643,18 +643,14 @@ int FileSystem::parse_directories(char *new_dir) strcpy(string, new_dir); } else - if(!is_root_dir(current_dir)) { -// current directory is not root - if(current_dir[strlen(current_dir) - 1] == '/') -// current_dir already has ending / - sprintf(string, "%s%s", current_dir, new_dir); - else -// need ending / - sprintf(string, "%s/%s", current_dir, new_dir); + snprintf(string, sizeof(string), + is_root_dir(current_dir) || + current_dir[strlen(current_dir)-1] == '/' ? +// current directory is root or already has ending / + "%s%s" : "%s/%s", + current_dir, new_dir); } - else - sprintf(string, "%s%s", current_dir, new_dir); //printf("FileSystem::parse_directories 3 %s %s\n", new_dir, string); strcpy(new_dir, string);