1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

Remove .stfolder generation and moveConfigFiles() (fixes #277).

This commit is contained in:
Felix Ableitner 2015-04-08 23:17:50 +02:00
parent fdb4371893
commit 8c75a8913d
2 changed files with 0 additions and 45 deletions

View file

@ -30,7 +30,6 @@ import com.nutomic.syncthingandroid.util.PRNGFixes;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.channels.FileChannel;
@ -228,37 +227,6 @@ public class SyncthingService extends Service {
onApiChange();
}
/**
* Move config file, keys, and index files to "official" folder
*
* Intended to bring the file locations in older installs in line with
* newer versions.
*/
private void moveConfigFiles() {
FilenameFilter idxFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".idx.gz");
}
};
if (new File(getApplicationInfo().dataDir, PUBLIC_KEY_FILE).exists()) {
File publicKey = new File(getApplicationInfo().dataDir, PUBLIC_KEY_FILE);
publicKey.renameTo(new File(getFilesDir(), PUBLIC_KEY_FILE));
File privateKey = new File(getApplicationInfo().dataDir, PRIVATE_KEY_FILE);
privateKey.renameTo(new File(getFilesDir(), PRIVATE_KEY_FILE));
File config = new File(getApplicationInfo().dataDir, ConfigXml.CONFIG_FILE);
config.renameTo(new File(getFilesDir(), ConfigXml.CONFIG_FILE));
File oldStorageDir = new File(getApplicationInfo().dataDir);
File[] files = oldStorageDir.listFiles(idxFilter);
for (File file : files) {
if (file.isFile()) {
file.renameTo(new File(getFilesDir(), file.getName()));
}
}
}
}
/**
* Starts the native binary.
*/
@ -297,10 +265,7 @@ public class SyncthingService extends Service {
private class StartupTask extends AsyncTask<Void, Void, Pair<String, String>> {
@Override
protected Pair<String, String> doInBackground(Void... voids) {
moveConfigFiles();
mConfig = new ConfigXml(SyncthingService.this);
return new Pair<>(mConfig.getWebGuiUrl(), mConfig.getApiKey());
}

View file

@ -137,16 +137,6 @@ public class ConfigXml {
changed = true;
}
// HACK: Create .stfolders in all folders if it does not exist.
// This is not the best place to put it, but it's only temporary.
String dir = r.getAttribute("path");
try {
new File(dir, ".stfolder").createNewFile();
} catch (IOException e) {
// This might happen if the device is not mounted.
Log.i(TAG, "Failed to create .stversions in " + dir, e);
}
if (applyLenientMTimes(r)) {
changed = true;
}