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:
Diffstat (limited to 'source/blender/blenkernel/intern/appdir.c')
-rw-r--r--source/blender/blenkernel/intern/appdir.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 6dd852c7875..8d4776dca0e 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -290,6 +290,33 @@ static bool get_path_user(
}
/**
+ * Special convenience exception for dev builds to allow overrides to the system path.
+ * With this, need for running 'make install' can be avoided, e.g. by symlinking SOURCE_DIR/release
+ * to EXECUTABLE_DIR/release, or by running Blender from source directory directly.
+ */
+static bool get_path_system_dev_build_exception(
+ char *targetpath, size_t targetpath_len, const char *relfolder)
+{
+ char cwd[FILE_MAX];
+
+ /* Try EXECUTABLE_DIR/release/folder_name. Allows symlinking release folder from source dir. */
+ if (test_path(targetpath, targetpath_len, bprogdir, "release", relfolder)) {
+ return true;
+ }
+ /* Try CWD/release/folder_name. Allows executing Blender from any directory
+ * (usually source dir), even without a release dir in bprogdir. */
+ if (BLI_current_working_dir(cwd, sizeof(cwd))) {
+ if (test_path(targetpath, targetpath_len, cwd, "release", relfolder)) {
+ return true;
+ }
+ }
+ /* never use if not existing. */
+ targetpath[0] = '\0';
+
+ return false;
+}
+
+/**
* Returns the path of a folder within the Blender installation directory.
*
* \param targetpath String to return path
@@ -305,7 +332,6 @@ static bool get_path_system(
{
char system_path[FILE_MAX];
const char *system_base_path;
- char cwd[FILE_MAX];
char relfolder[FILE_MAX];
if (folder_name) {
@@ -320,25 +346,9 @@ static bool get_path_system(
relfolder[0] = '\0';
}
- /* first allow developer only overrides to the system path
- * these are only used when running blender from source */
-
- /* try CWD/release/folder_name */
- if (BLI_current_working_dir(cwd, sizeof(cwd))) {
- if (test_path(targetpath, targetpath_len, cwd, "release", relfolder)) {
- return true;
- }
- }
- /* try EXECUTABLE_DIR/release/folder_name */
- if (test_path(targetpath, targetpath_len, bprogdir, "release", relfolder)) {
+ if (get_path_system_dev_build_exception(targetpath, targetpath_len, relfolder)) {
return true;
}
- /* never use if not existing. */
- targetpath[0] = '\0';
-
- /* end developer overrides */
-
-
system_path[0] = '\0';