fixed a bug that prefent the cloud controller from geting the latest cloud sync
This commit is contained in:
parent
42b8434a58
commit
599669f0f2
|
@ -1555,6 +1555,7 @@ public class MainWindowController {
|
||||||
} else {
|
} else {
|
||||||
props.setProperty("cloudService", getCloudService());
|
props.setProperty("cloudService", getCloudService());
|
||||||
}
|
}
|
||||||
|
props.setProperty("folderID", main.getCloudController().getFolderID(getCloudService()));
|
||||||
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
||||||
props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth()));
|
props.setProperty("windowWidth", String.valueOf(mainAnchorPane.getWidth()));
|
||||||
props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight()));
|
props.setProperty("windowHeight", String.valueOf(mainAnchorPane.getHeight()));
|
||||||
|
@ -1642,6 +1643,13 @@ public class MainWindowController {
|
||||||
setCloudService("");
|
setCloudService("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
main.getCloudController().setFolderID(props.getProperty("folderID"), getCloudService());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("could not load folderID, disable cloud sync. Please contact an developer", e);
|
||||||
|
setCloudSync(false);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLastLocalSync(Long.parseLong(props.getProperty("lastLocalSync")));
|
setLastLocalSync(Long.parseLong(props.getProperty("lastLocalSync")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -202,4 +202,28 @@ public class CloudController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFolderID(String cloudService) {
|
||||||
|
String folderID = "";
|
||||||
|
if (cloudService != null) {
|
||||||
|
if (cloudService.equals("GoogleDrive")) {
|
||||||
|
folderID = googleDriveController.getFolderID();
|
||||||
|
}
|
||||||
|
if (cloudService.equals("Dropbox")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return folderID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolderID(String folderID, String cloudService) {
|
||||||
|
if (cloudService != null) {
|
||||||
|
if (cloudService.equals("GoogleDrive")) {
|
||||||
|
googleDriveController.setFolderID(folderID);
|
||||||
|
}
|
||||||
|
if (cloudService.equals("Dropbox")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,9 +116,12 @@ public class GoogleDriveController {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void main(String cemuDirectory) throws IOException {
|
public void main(String cemuDirectory) throws IOException {
|
||||||
service = getDriveService();
|
service = getDriveService();
|
||||||
|
|
||||||
|
if (getFolderID() == "" || getFolderID() == null) {
|
||||||
|
getSavegamesFolderID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a folder in google drive
|
// create a folder in google drive
|
||||||
|
@ -203,4 +206,24 @@ public class GoogleDriveController {
|
||||||
return outputFile;
|
return outputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getSavegamesFolderID() throws IOException {
|
||||||
|
Files.List request = service.files().list().setQ("mimeType = 'application/vnd.google-apps.folder' and name = 'cemu_savegames'");
|
||||||
|
FileList files = request.execute();
|
||||||
|
|
||||||
|
try {
|
||||||
|
LOGGER.info("FolderID: " + files.getFiles().get(0).getId());
|
||||||
|
setFolderID(files.getFiles().get(0).getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Oops, something went wrong! It seems that you have more than one folder called 'cemu_savegames'!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFolderID() {
|
||||||
|
return folderID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolderID(String folderID) {
|
||||||
|
this.folderID = folderID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue