22
33import com .dazednconfused .catalauncher .Application ;
44
5+ import java .nio .file .Path ;
6+
57/**
68 * A set of common filesystem {@link Paths} used throughout the application.
79 * */
@@ -11,8 +13,8 @@ public class Paths {
1113 * Retrieves the {@link Application}'s root folder - that is, the filesystem path where the binary is currently executing.
1214 * Most defined {@link Paths} depend on this one.
1315 * */
14- public static String getLauncherRootFolder () {
15- return Application .getRootFolder ();
16+ public static Path getLauncherRootFolder () {
17+ return Path . of ( Application .getRootFolder () );
1618 }
1719
1820 /**
@@ -22,8 +24,8 @@ public static String getLauncherRootFolder() {
2224 * getLauncherRootFolder() + "/.macatalauncher"
2325 * }</pre>
2426 * */
25- public static String getLauncherFiles () {
26- return getLauncherRootFolder () + "/ .macatalauncher" ;
27+ public static Path getLauncherFiles () {
28+ return getLauncherRootFolder (). resolve ( " .macatalauncher") ;
2729 }
2830
2931 /**
@@ -33,19 +35,19 @@ public static String getLauncherFiles() {
3335 * getLauncherRootFolder() + "/.macatalauncher/logs/main.log"
3436 * }</pre>
3537 * */
36- public static String getLogFilePath () {
37- return getLauncherFiles () + "/ logs/main.log" ;
38+ public static Path getLogFilePath () {
39+ return getLauncherFiles (). resolve ( " logs/main.log") ;
3840 }
3941
4042 /**
4143 * Retrieves the {@link Application}'s custom savefile path.
4244 *
4345 * <pre> {@code
44- * getLauncherRootFolder() + "/saves/ "
46+ * getLauncherRootFolder() + "/saves"
4547 * }</pre>
4648 * */
47- public static String getCustomSavePath () {
48- return getLauncherRootFolder () + "/ saves/" ;
49+ public static Path getCustomSavePath () {
50+ return getLauncherRootFolder (). resolve ( " saves" ) ;
4951 }
5052
5153 /**
@@ -55,19 +57,19 @@ public static String getCustomSavePath() {
5557 * getLauncherRootFolder() + "/trashed"
5658 * }</pre>
5759 * */
58- public static String getCustomTrashedPath () {
59- return getLauncherRootFolder () + "/ trashed" ;
60+ public static Path getCustomTrashedPath () {
61+ return getLauncherRootFolder (). resolve ( " trashed") ;
6062 }
6163
6264 /**
6365 * Retrieves the {@link Application}'s custom path for trashed savefiles.
6466 *
6567 * <pre> {@code
66- * getLauncherRootFolder() + "/trashed/saves/ "
68+ * getLauncherRootFolder() + "/trashed/saves"
6769 * }</pre>
6870 * */
69- public static String getCustomTrashedSavePath () {
70- return getCustomTrashedPath () + "/ saves/" ;
71+ public static Path getCustomTrashedSavePath () {
72+ return getCustomTrashedPath (). resolve ( " saves" ) ;
7173 }
7274
7375 /**
@@ -77,64 +79,63 @@ public static String getCustomTrashedSavePath() {
7779 * getLauncherRootFolder() + "/backups"
7880 * }</pre>
7981 * */
80- public static String getSaveBackupPath () {
81- return getLauncherRootFolder () + "/ backups" ;
82+ public static Path getSaveBackupPath () {
83+ return getLauncherRootFolder (). resolve ( " backups") ;
8284 }
8385
8486 /**
8587 * Retrieves the {@link Application}'s custom {@code userdir/} directory.
8688 *
8789 * <pre> {@code
88- * getLauncherRootFolder() + "/userdir/ "
90+ * getLauncherRootFolder() + "/userdir"
8991 * }</pre>
9092 * */
91- public static String getCustomUserDir () {
92- return getLauncherRootFolder () + "/ userdir/" ;
93+ public static Path getCustomUserDir () {
94+ return getLauncherRootFolder (). resolve ( " userdir" ) ;
9395 }
9496
9597 /**
9698 * Retrieves the {@link Application}'s custom {@code userdir/sound} directory.
9799 *
98100 * <pre> {@code
99- * getLauncherRootFolder() + "/userdir/sound/ "
101+ * getLauncherRootFolder() + "/userdir/sound"
100102 * }</pre>
101103 * */
102- public static String getCustomSoundpacksDir () {
103- return getCustomUserDir () + "sound/" ;
104+ public static Path getCustomSoundpacksDir () {
105+ return getCustomUserDir (). resolve ( "sound" ) ;
104106 }
105107
106108 /**
107109 * Retrieves the {@link Application}'s custom {@code userdir/mods} directory.
108110 *
109111 * <pre> {@code
110- * getLauncherRootFolder() + "/userdir/mods/ "
112+ * getLauncherRootFolder() + "/userdir/mods"
111113 * }</pre>
112114 * */
113- public static String getCustomModsDir () {
114- return getCustomUserDir () + "mods/" ;
115+ public static Path getCustomModsDir () {
116+ return getCustomUserDir (). resolve ( "mods" ) ;
115117 }
116118
117119 /**
118120 * Retrieves the {@link Application}'s custom path for trashed mods.
119121 *
120122 * <pre> {@code
121- * getLauncherRootFolder() + "/trashed/saves/ "
123+ * getLauncherRootFolder() + "/trashed/mods "
122124 * }</pre>
123125 * */
124- public static String getCustomTrashedModsPath () {
125- return getCustomTrashedPath () + "/ mods/" ;
126+ public static Path getCustomTrashedModsPath () {
127+ return getCustomTrashedPath (). resolve ( " mods" ) ;
126128 }
127129
128-
129130 /**
130131 * Retrieves the {@link Application}'s database(s) directory.
131132 *
132133 * <pre> {@code
133134 * getLauncherRootFolder() + "/.macatalauncher/db"
134135 * }</pre>
135136 * */
136- public static String getDatabaseDirectory () {
137- return getLauncherFiles () + "/ db" ;
137+ public static Path getDatabaseDirectory () {
138+ return getLauncherFiles (). resolve ( " db") ;
138139 }
139140
140141 // java resources
0 commit comments