mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-12-09 05:29:12 +00:00
Merge e55939a589 into 758f712eb5
This commit is contained in:
commit
ddb67a8100
|
|
@ -58,7 +58,7 @@ class FileUtil
|
|||
*/
|
||||
public static var PROTECTED_PATHS(get, never):Array<String>;
|
||||
|
||||
public static function get_PROTECTED_PATHS():Array<String>
|
||||
static function get_PROTECTED_PATHS():Array<String>
|
||||
{
|
||||
final protected:Array<String> = [
|
||||
'',
|
||||
|
|
@ -83,7 +83,8 @@ class FileUtil
|
|||
#if sys
|
||||
for (i in 0...protected.length)
|
||||
{
|
||||
protected[i] = sys.FileSystem.fullPath(Path.join([gameDirectory, protected[i]]));
|
||||
// On Linux 'fullPath' just makes most of these null which actually just makes the paths unprotected
|
||||
protected[i] = #if !linux sys.FileSystem.fullPath #end (Path.join([gameDirectory, protected[i]]));
|
||||
}
|
||||
#end
|
||||
|
||||
|
|
@ -1306,8 +1307,26 @@ class FileUtilSandboxed
|
|||
|
||||
#if sys
|
||||
// TODO: figure out how to get "real" path of symlinked paths
|
||||
final realPath:String = sys.FileSystem.fullPath(Path.join([FileUtil.gameDirectory, sanitized.join('/')]));
|
||||
if (!realPath.startsWith(FileUtil.gameDirectory))
|
||||
#if linux
|
||||
// The implementation on Linux fails if the path doesn't exist
|
||||
var realPath:Null<String> = null;
|
||||
var unresolvedSegments:Array<String> = [];
|
||||
while (realPath == null && sanitized.length > 0)
|
||||
{
|
||||
realPath = sys.FileSystem.fullPath(Path.join([FileUtil.gameDirectory].concat(sanitized)));
|
||||
if (realPath == null) unresolvedSegments.unshift(sanitized.pop() ?? continue);
|
||||
}
|
||||
|
||||
if (unresolvedSegments.length > 0)
|
||||
{
|
||||
if (realPath != null) unresolvedSegments.unshift(realPath);
|
||||
realPath = Path.join(unresolvedSegments);
|
||||
}
|
||||
#else
|
||||
final realPath:Null<String> = sys.FileSystem.fullPath(Path.join([FileUtil.gameDirectory].concat(sanitized)));
|
||||
#end
|
||||
|
||||
if (realPath == null || !realPath.startsWith(FileUtil.gameDirectory))
|
||||
{
|
||||
return FileUtil.gameDirectory;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue