- add convenience functions BLI_split_dir_part / BLI_split_file_part, which just call BLI_split_dirfile().

- add a fixed value for bprogdir (the dir of bprogname), since it was being used for resource lookups.
This commit is contained in:
Campbell Barton
2011-10-21 02:13:36 +00:00
parent 9ec0ea91f0
commit ef218c75ed
14 changed files with 32 additions and 23 deletions

View File

@@ -502,7 +502,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
BLI_path_abs(cpath, gp_GamePythonPath);
} else {
/* Get the dir only */
BLI_split_dirfile(gp_GamePythonPath, cpath, NULL, sizeof(cpath), 0);
BLI_split_dir_part(gp_GamePythonPath, cpath, sizeof(cpath));
}
if((dp = opendir(cpath)) == NULL) {
@@ -1732,7 +1732,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename)
PyObject *item;
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_split_dirfile(filename, expanded, NULL, sizeof(expanded), 0); /* get the dir part of filename only */
BLI_split_dir_part(filename, expanded, sizeof(expanded)); /* get the dir part of filename only */
BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
item= PyUnicode_DecodeFSDefault(expanded);