Skip to content

Commit

Permalink
Move gd save files to external at files/save
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Sep 16, 2023
1 parent c44a4f0 commit 20a3b64
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions app/src/main/java/com/geode/launcher/GeometryDashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
e.printStackTrace()
}

try {
// fixes bugs specific to the new app directory, such as package name
LauncherFix.loadLibrary()
LauncherFix.setOriginalDataPath(Constants.GJ_DATA_DIR)
LauncherFix.setDataPath(filesDir.path)
} catch (e: UnsatisfiedLinkError) {
e.printStackTrace()
}
fixLauncherPath()

Cocos2dxHelper.init(this, this)

Expand Down Expand Up @@ -103,6 +96,22 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
}
}

private fun fixLauncherPath() {
try {
// fixes bugs specific to the new app directory, such as package name
LauncherFix.loadLibrary()
getExternalFilesDir(null)?.let { dir ->
val externalPath = dir.path + File.separator + "save"

LauncherFix.setOriginalDataPath(Constants.GJ_DATA_DIR)
LauncherFix.setDataPath(externalPath)
}

} catch (e: UnsatisfiedLinkError) {
e.printStackTrace()
}
}

@SuppressLint("UnsafeDynamicallyLoadedCode")
private fun loadGeodeLibrary(): Boolean {
// Load Geode if exists
Expand Down

0 comments on commit 20a3b64

Please sign in to comment.