-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfnf-psychengine-fix_user_data.patch
89 lines (78 loc) · 2.97 KB
/
fnf-psychengine-fix_user_data.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
diff --git a/source/Main.hx b/source/Main.hx
index b60c1c4..c0ed6bc 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -163,6 +163,7 @@ class Main extends Sprite
function onCrash(e:UncaughtErrorEvent):Void
{
var errMsg:String = "";
+ var crashDir:String = Sys.getEnv("XDG_DATA_HOME") + "/crash/";
var path:String;
var callStack:Array<StackItem> = CallStack.exceptionStack(true);
var dateNow:String = Date.now().toString();
@@ -170,7 +171,7 @@ class Main extends Sprite
dateNow = dateNow.replace(" ", "_");
dateNow = dateNow.replace(":", "'");
- path = "./crash/" + "PsychEngine_" + dateNow + ".txt";
+ path = crashDir + "PsychEngine_" + dateNow + ".txt";
for (stackItem in callStack)
{
@@ -185,8 +186,8 @@ class Main extends Sprite
errMsg += "\nUncaught Error: " + e.error + "\nPlease report this error to the GitHub page: https://github.com/ShadowMario/FNF-PsychEngine\n\n> Crash Handler written by: sqirra-rng";
- if (!FileSystem.exists("./crash/"))
- FileSystem.createDirectory("./crash/");
+ if (!FileSystem.exists(crashDir))
+ FileSystem.createDirectory(crashDir);
File.saveContent(path, errMsg + "\n");
diff --git a/source/backend/Mods.hx b/source/backend/Mods.hx
index 87e8b42..963b508 100644
--- a/source/backend/Mods.hx
+++ b/source/backend/Mods.hx
@@ -151,7 +151,7 @@ class Mods
#if MODS_ALLOWED
try {
- for (mod in CoolUtil.coolTextFile('modsList.txt'))
+ for (mod in CoolUtil.coolTextFile(Sys.getEnv("XDG_DATA_HOME") + '/modsList.txt'))
{
//trace('Mod: $mod');
if(mod.trim().length < 1) continue;
@@ -177,7 +177,7 @@ class Mods
var list:Array<Array<Dynamic>> = [];
var added:Array<String> = [];
try {
- for (mod in CoolUtil.coolTextFile('modsList.txt'))
+ for (mod in CoolUtil.coolTextFile(Sys.getEnv("XDG_DATA_HOME") + '/modsList.txt'))
{
var dat:Array<String> = mod.split("|");
var folder:String = dat[0];
@@ -211,7 +211,7 @@ class Mods
fileStr += values[0] + '|' + (values[1] ? '1' : '0');
}
- File.saveContent('modsList.txt', fileStr);
+ File.saveContent(Sys.getEnv("XDG_DATA_HOME") + '/modsList.txt', fileStr);
updatedOnState = true;
//trace('Saved modsList.txt');
#end
diff --git a/source/backend/Paths.hx b/source/backend/Paths.hx
index eb78142..abd1dfc 100644
--- a/source/backend/Paths.hx
+++ b/source/backend/Paths.hx
@@ -469,7 +469,7 @@ class Paths
#if MODS_ALLOWED
inline static public function mods(key:String = '') {
- return 'mods/' + key;
+ return Sys.getEnv("XDG_DATA_HOME") + '/mods/' + key;
}
inline static public function modsFont(key:String) {
diff --git a/source/states/ModsMenuState.hx b/source/states/ModsMenuState.hx
index 7da15f0..50e8e40 100644
--- a/source/states/ModsMenuState.hx
+++ b/source/states/ModsMenuState.hx
@@ -794,7 +794,7 @@ class ModsMenuState extends MusicBeatState
fileStr += '$mod|$on';
}
- var path:String = 'modsList.txt';
+ var path:String = Sys.getEnv("XDG_DATA_HOME") + '/modsList.txt';
File.saveContent(path, fileStr);
}
}