Skip to content

Commit

Permalink
Improve: use ZygoteLoader data directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr328 committed Feb 1, 2022
1 parent 3180d1d commit 0a275ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions module/src/main/assets/customize.d/90-migrate-legacy-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Migrate legacy data to ZygoteLoader data directory

ui_print "- Migrate legacy data directory"

if [ -f "/data/misc/clipboard/whitelist.list" ]; then
mkdir -p "$MODULE_DATA_PATH"
cp -f "/data/misc/clipboard/whitelist.list" "$MODULE_DATA_PATH/whitelist.list"
rm -rf "/data/misc/clipboard"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static java.nio.file.StandardOpenOption.WRITE;

import com.github.kr328.clipboard.shared.Log;
import com.github.kr328.zloader.ZygoteLoader;

import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -19,13 +20,15 @@
import java.util.Set;

public class DataStore {
public static final String DATA_PATH = "/data/misc/clipboard/whitelist.list";
public static final String DATA_PATH = ZygoteLoader.getDataDirectory() + "/whitelist.list";

public final static DataStore instance = new DataStore();

private final Set<String> packages = new HashSet<>();

private DataStore() {
Log.i("Load data from " + DATA_PATH);

try {
List<String> data = Files.readAllLines(Paths.get(DATA_PATH));

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencyResolutionManagement {
versionCatalogs {
create("deps") {
val agp = "7.1.0"
val zloader = "1.8"
val zloader = "1.9"
val refine = "3.0.3"
val magic = "1.4"

Expand Down

0 comments on commit 0a275ef

Please sign in to comment.