mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
Remove $APP abruptly
This commit is contained in:
parent
07e714bb16
commit
3311799efe
@ -203,8 +203,6 @@ ns_get_environment_variable(const string &var) const {
|
||||
return Filename::get_home_directory().to_os_specific();
|
||||
} else if (var == "TEMP") {
|
||||
return Filename::get_temp_directory().to_os_specific();
|
||||
} else if (var == "APP") {
|
||||
return Filename::get_app_directory().to_os_specific();
|
||||
} else if (var == "USER_APPDATA") {
|
||||
return Filename::get_user_appdata_directory().to_os_specific();
|
||||
} else if (var == "COMMON_APPDATA") {
|
||||
|
@ -51,7 +51,6 @@
|
||||
|
||||
Filename *Filename::_home_directory;
|
||||
Filename *Filename::_temp_directory;
|
||||
Filename *Filename::_app_directory;
|
||||
Filename *Filename::_user_appdata_directory;
|
||||
Filename *Filename::_common_appdata_directory;
|
||||
TypeHandle Filename::_type_handle;
|
||||
@ -561,52 +560,6 @@ get_temp_directory() {
|
||||
return (*_temp_directory);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Filename::get_app_directory
|
||||
// Access: Published
|
||||
// Description: Returns a path to the current application's
|
||||
// directory, as nearly as this can be determined.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
const Filename &Filename::
|
||||
get_app_directory() {
|
||||
if (AtomicAdjust::get_ptr(_app_directory) == NULL) {
|
||||
Filename app_directory;
|
||||
|
||||
#if defined(IS_OSX)
|
||||
app_directory = get_osx_app_directory();
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
if (app_directory.empty()) {
|
||||
// Fallback case.
|
||||
Filename binary_name = ExecutionEnvironment::get_binary_name();
|
||||
if (!binary_name.empty()) {
|
||||
app_directory = binary_name.get_dirname();
|
||||
}
|
||||
}
|
||||
if (app_directory.empty()) {
|
||||
// Another fallback.
|
||||
Filename dtool_name = ExecutionEnvironment::get_dtool_name();
|
||||
if (!dtool_name.empty()) {
|
||||
app_directory = dtool_name.get_dirname();
|
||||
}
|
||||
}
|
||||
if (app_directory.empty()) {
|
||||
// The final fallback.
|
||||
app_directory = ExecutionEnvironment::get_cwd();
|
||||
}
|
||||
|
||||
Filename *newdir = new Filename(app_directory);
|
||||
if (AtomicAdjust::compare_and_exchange_ptr((void * TVOLATILE &)_app_directory, NULL, newdir) != NULL) {
|
||||
// Didn't store it. Must have been stored by someone else.
|
||||
assert(_app_directory != NULL);
|
||||
delete newdir;
|
||||
}
|
||||
}
|
||||
|
||||
return (*_app_directory);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Filename::get_user_appdata_directory
|
||||
// Access: Published
|
||||
|
@ -86,7 +86,6 @@ PUBLISHED:
|
||||
|
||||
static const Filename &get_home_directory();
|
||||
static const Filename &get_temp_directory();
|
||||
static const Filename &get_app_directory();
|
||||
static const Filename &get_user_appdata_directory();
|
||||
static const Filename &get_common_appdata_directory();
|
||||
|
||||
@ -234,7 +233,6 @@ protected:
|
||||
|
||||
static Filename *_home_directory;
|
||||
static Filename *_temp_directory;
|
||||
static Filename *_app_directory;
|
||||
static Filename *_user_appdata_directory;
|
||||
static Filename *_common_appdata_directory;
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
string get_osx_home_directory();
|
||||
string get_osx_temp_directory();
|
||||
string get_osx_app_directory();
|
||||
string get_osx_user_appdata_directory();
|
||||
string get_osx_common_appdata_directory();
|
||||
|
||||
|
@ -81,29 +81,6 @@ get_osx_home_directory() {
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_osx_app_directory
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string
|
||||
get_osx_app_directory() {
|
||||
#ifndef BUILD_IPHONE
|
||||
NSApplicationLoad();
|
||||
#endif
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
string result;
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
if (bundle != nil) {
|
||||
NSString *dir = [bundle bundlePath];
|
||||
result = NSString_to_cpp_string(dir);
|
||||
}
|
||||
[pool release];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: get_NSCachesDirectory
|
||||
// Description:
|
||||
|
Loading…
x
Reference in New Issue
Block a user