diff options
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index ec8e1cf6b82..41a73aaf4ba 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -335,7 +335,7 @@ void BLI_cleanup_path(const char *relabase, char *dir) * is the same as * strcpy( start, eind ); * except strcpy should not be used because there is overlap, - * so use memmove's slightly more obscure syntax - Campbell + * so use memmove's slightly more obscure syntax - Campbell */ #ifdef WIN32 @@ -439,7 +439,7 @@ void BLI_path_rel(char *file, const char *relfile) if (BLI_strnlen(relfile, 3) > 2 && relfile[1] != ':') { char* ptemp; /* fix missing volume name in relative base, - can happen with old recent-files.txt files */ + * can happen with old recent-files.txt files */ get_default_root(temp); ptemp = &temp[2]; if (relfile[0] != '\\' && relfile[0] != '/') { @@ -471,7 +471,7 @@ void BLI_path_rel(char *file, const char *relfile) if (lslash) { /* find the prefix of the filename that is equal for both filenames. - This is replaced by the two slashes at the beginning */ + * This is replaced by the two slashes at the beginning */ char *p= temp; char *q= file; @@ -490,8 +490,8 @@ void BLI_path_rel(char *file, const char *relfile) } /* we might have passed the slash when the beginning of a dir matches - so we rewind. Only check on the actual filename - */ + * so we rewind. Only check on the actual filename + */ if (*q != '/') { while ( (q >= file) && (*q != '/') ) { --q; --p; } } @@ -502,10 +502,10 @@ void BLI_path_rel(char *file, const char *relfile) strcpy(res, "//"); /* p now points to the slash that is at the beginning of the part - where the path is different from the relative path. - We count the number of directories we need to go up in the - hierarchy to arrive at the common 'prefix' of the path - */ + * where the path is different from the relative path. + * We count the number of directories we need to go up in the + * hierarchy to arrive at the common 'prefix' of the path + */ while (p && p < lslash) { if (*p == '/') strcat(res, "../"); @@ -646,9 +646,9 @@ int BLI_path_abs(char *path, const char *basepath) BLI_strncpy(vol, path, 3); /* 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. - */ + * 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); @@ -685,11 +685,11 @@ int BLI_path_abs(char *path, const char *basepath) BLI_cleanup_path(NULL, base); /* push slashes into unix mode - strings entering this part are - potentially messed up: having both back- and forward slashes. - Here we push into one conform direction, and at the end we - push them into the system specific dir. This ensures uniformity - of paths and solving some problems (and prevent potential future - ones) -jesterKing. */ + * potentially messed up: having both back- and forward slashes. + * Here we push into one conform direction, and at the end we + * push them into the system specific dir. This ensures uniformity + * of paths and solving some problems (and prevent potential future + * ones) -jesterKing. */ BLI_char_switch(tmp, '\\', '/'); BLI_char_switch(base, '\\', '/'); @@ -716,11 +716,11 @@ int BLI_path_abs(char *path, const char *basepath) #ifdef WIN32 /* skip first two chars, which in case of - absolute path will be drive:/blabla and - in case of relpath //blabla/. So relpath - // will be retained, rest will be nice and - shiny win32 backward slashes :) -jesterKing - */ + * absolute path will be drive:/blabla and + * in case of relpath //blabla/. So relpath + * // will be retained, rest will be nice and + * shiny win32 backward slashes :) -jesterKing + */ BLI_char_switch(path+2, '/', '\\'); #endif @@ -753,12 +753,12 @@ int BLI_path_cwd(char *path) printf( "Could not get the current working directory - $PWD for an unknown reason."); } else { /* uses the blend path relative to cwd important for loading relative linked files. - * - * cwd should contain c:\ etc on win32 so the relbase can be NULL - * relbase being NULL also prevents // being misunderstood as relative to the current - * blend file which isnt a feature we want to use in this case since were dealing - * with a path from the command line, rather than from inside Blender */ - + * + * cwd should contain c:\ etc on win32 so the relbase can be NULL + * relbase being NULL also prevents // being misunderstood as relative to the current + * blend file which isnt a feature we want to use in this case since were dealing + * with a path from the command line, rather than from inside Blender */ + char origpath[FILE_MAX]; BLI_strncpy(origpath, path, FILE_MAX); @@ -805,7 +805,7 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen) /* This is now only used to really get the user's default document folder */ /* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used - as default location to save documents */ + * as default location to save documents */ const char *BLI_getDefaultDocumentFolder(void) { #ifndef WIN32 @@ -1196,8 +1196,8 @@ void BLI_setenv(const char *env, const char*val) /** - Only set an env var if already not there. - Like Unix setenv(env, val, 0); + * Only set an env var if already not there. + * Like Unix setenv(env, val, 0); */ void BLI_setenv_if_new(const char *env, const char* val) { @@ -1288,13 +1288,13 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, /* we first push all slashes into unix mode, just to make sure we don't get - any mess with slashes later on. -jesterKing */ + * any mess with slashes later on. -jesterKing */ /* constant strings can be passed for those parameters - don't change them - elubie */ - /* +#if 0 BLI_char_switch(relabase, '\\', '/'); BLI_char_switch(dir, '\\', '/'); BLI_char_switch(file, '\\', '/'); - */ +#endif /* Resolve relative references */ if (relabase && dir[0] == '/' && dir[1] == '/') { @@ -1547,31 +1547,31 @@ char *BLI_path_basename(char *path) return filename ? filename + 1 : path; } -/* - Produce image export path. - - Fails returning 0 if image filename is empty or if destination path - matches image path (i.e. both are the same file). - - Trailing slash in dest_dir is optional. - - Logic: - - - if an image is "below" current .blend file directory, rebuild the - same dir structure in dest_dir - - For example //textures/foo/bar.png becomes - [dest_dir]/textures/foo/bar.png. - - - if an image is not "below" current .blend file directory, - disregard it's path and copy it in the same directory where 3D file - goes. - - For example //../foo/bar.png becomes [dest_dir]/bar.png. - - This logic will help ensure that all image paths are relative and - that a user gets his images in one place. It'll also provide - consistent behavior across exporters. +/** + * Produce image export path. + * + * Fails returning 0 if image filename is empty or if destination path + * matches image path (i.e. both are the same file). + * + * Trailing slash in dest_dir is optional. + * + * Logic: + * + * - if an image is "below" current .blend file directory, rebuild the + * same dir structure in dest_dir + * + * For example //textures/foo/bar.png becomes + * [dest_dir]/textures/foo/bar.png. + * + * - if an image is not "below" current .blend file directory, + * disregard it's path and copy it in the same directory where 3D file + * goes. + * + * For example //../foo/bar.png becomes [dest_dir]/bar.png. + * + * This logic will help ensure that all image paths are relative and + * that a user gets his images in one place. It'll also provide + * consistent behavior across exporters. */ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir) { @@ -1740,18 +1740,18 @@ static int add_win32_extension(char *name) return (retval); } -/* -* Checks if name is a fully qualified filename to an executable. -* If not it searches $PATH for the file. On Windows it also -* adds the correct extension (.com .exe etc) from -* $PATHEXT if necessary. Also on Windows it translates -* the name to its 8.3 version to prevent problems with -* spaces and stuff. Final result is returned in fullname. -* -* \param fullname The full path and full name of the executable -* (must be FILE_MAX minimum) -* \param name The name of the executable (usually argv[0]) to be checked -*/ +/** + * Checks if name is a fully qualified filename to an executable. + * If not it searches $PATH for the file. On Windows it also + * adds the correct extension (.com .exe etc) from + * $PATHEXT if necessary. Also on Windows it translates + * the name to its 8.3 version to prevent problems with + * spaces and stuff. Final result is returned in fullname. + * + * \param fullname The full path and full name of the executable + * (must be FILE_MAX minimum) + * \param name The name of the executable (usually argv[0]) to be checked + */ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name) { char filename[FILE_MAX]; @@ -1849,15 +1849,15 @@ const char *BLI_program_dir(void) } /** -* Gets the temp directory when blender first runs. -* If the default path is not found, use try $TEMP -* -* Also make sure the temp dir has a trailing slash -* -* \param fullname The full path to the temp directory -* \param maxlen The size of the fullname buffer -* \param userdir Directory specified in user preferences -*/ + * Gets the temp directory when blender first runs. + * If the default path is not found, use try $TEMP + * + * Also make sure the temp dir has a trailing slash + * + * \param fullname The full path to the temp directory + * \param maxlen The size of the fullname buffer + * \param userdir Directory specified in user preferences + */ static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) { fullname[0] = '\0'; |