Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import ca.pkay.rcloneexplorer.Items.SyncDirectionObject;
import ca.pkay.rcloneexplorer.rclone.Provider;
import ca.pkay.rcloneexplorer.util.FLog;
import ca.pkay.rcloneexplorer.util.SyncLog;
import es.dmoral.toasty.Toasty;
import io.github.x0b.safdav.SafAccessProvider;
import io.github.x0b.safdav.SafDAVServer;
Expand Down Expand Up @@ -226,7 +227,9 @@ public void logErrorOutput(Process process) {
}
return;
}
log2File.log(stringBuilder.toString());
String logOutput = stringBuilder.toString();
log2File.log(logOutput);
SyncLog.error(context, "Rclone operation", logOutput);
}

@Nullable
Expand Down Expand Up @@ -262,7 +265,7 @@ public List<FileItem> getDirectoryContent(RemoteItem remote, String path, boolea
}
String[] env = getRcloneEnv();
JSONArray results;
Process process;
Process process = null;
try {
FLog.d(TAG, "getDirectoryContent[ENV]: %s", Arrays.toString(env));
process = getRuntimeProcess(command, env);
Expand All @@ -285,9 +288,11 @@ public List<FileItem> getDirectoryContent(RemoteItem remote, String path, boolea
results = new JSONArray(outputStr);

} catch (InterruptedException e) {
logErrorOutput(process);
FLog.d(TAG, "getDirectoryContent: Aborted refreshing folder");
return null;
} catch (IOException | JSONException e) {
logErrorOutput(process);
FLog.e(TAG, "getDirectoryContent: Could not get folder content", e);
return null;
}
Expand Down Expand Up @@ -315,6 +320,7 @@ public List<FileItem> getDirectoryContent(RemoteItem remote, String path, boolea
FileItem fileItem = new FileItem(remote, filePath, fileName, fileSize, fileModTime, mimeType, fileIsDir, startAtRoot);
fileItemList.add(fileItem);
} catch (JSONException e) {
logErrorOutput(process);
FLog.e(TAG, "getDirectoryContent: Could not decode JSON", e);
return null;
}
Expand All @@ -325,7 +331,7 @@ public List<FileItem> getDirectoryContent(RemoteItem remote, String path, boolea
public List<RemoteItem> getRemotes() {
String[] command = createCommand("config", "dump");
StringBuilder output = new StringBuilder();
Process process;
Process process = null;
JSONObject remotesJSON;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
Set<String> pinnedRemotes = sharedPreferences.getStringSet(context.getString(R.string.shared_preferences_pinned_remotes), new HashSet<>());
Expand All @@ -348,6 +354,7 @@ public List<RemoteItem> getRemotes() {

remotesJSON = new JSONObject(output.toString());
} catch (IOException | InterruptedException | JSONException e) {
logErrorOutput(process);
FLog.e(TAG, "getRemotes: error retrieving remotes", e);
return new ArrayList<>();
}
Expand Down Expand Up @@ -389,6 +396,7 @@ public List<RemoteItem> getRemotes() {

remoteItemList.add(newRemote);
} catch (JSONException e) {
logErrorOutput(process);
FLog.e(TAG, "getRemotes: error decoding remotes", e);
return new ArrayList<>();
}
Expand Down