mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
The full executable path, rather than argv[0], is now used when determining whether the executable is fused (resolves issue #1043.)
This commit is contained in:
@@ -45,6 +45,11 @@ std::string getLoveInResources();
|
||||
**/
|
||||
std::string checkDropEvents();
|
||||
|
||||
/**
|
||||
* Returns the full path to the executable.
|
||||
**/
|
||||
std::string getExecutablePath();
|
||||
|
||||
} // osx
|
||||
} // love
|
||||
|
||||
|
||||
@@ -69,6 +69,14 @@ std::string checkDropEvents()
|
||||
return dropstr;
|
||||
}
|
||||
|
||||
std::string getExecutablePath()
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
return std::string([NSBundle mainBundle].executablePath.UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
} // osx
|
||||
} // love
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ std::string getHomeDirectory();
|
||||
**/
|
||||
bool openURL(const std::string &url);
|
||||
|
||||
/**
|
||||
* Returns the full path to the executable.
|
||||
**/
|
||||
std::string getExecutablePath();
|
||||
|
||||
} // ios
|
||||
} // love
|
||||
|
||||
|
||||
+11
-2
@@ -305,15 +305,24 @@ bool openURL(const std::string &url)
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
UIApplication *app = [UIApplication sharedApplication];
|
||||
NSURL *nsurl = [NSURL URLWithString:@(url.c_str())];
|
||||
|
||||
if ([[UIApplication sharedApplication] canOpenURL:nsurl])
|
||||
success = [[UIApplication sharedApplication] openURL:nsurl];
|
||||
if ([app canOpenURL:nsurl])
|
||||
success = [app openURL:nsurl];
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
std::string getExecutablePath()
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
return std::string([NSBundle mainBundle].executablePath.UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
} // ios
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user