Browse Source

Support $MAIN_DIR for the poor C++ users

rdb 16 years ago
parent
commit
ace7910a44
1 changed files with 6 additions and 1 deletions
  1. 6 1
      dtool/src/dtoolutil/executionEnvironment.cxx

+ 6 - 1
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -537,6 +537,11 @@ read_args() {
   }
 #endif
 
-  if (_dtool_name.empty())
+  if (!_binary_name.empty()) {
+    set_environment_variable("MAIN_DIR", Filename(_binary_name).get_dirname());
+  }
+
+  if (_dtool_name.empty()) {
     _dtool_name = _binary_name;
+  }
 }