Skip to content

Commit

Permalink
Change message on save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
cwisniew committed Aug 27, 2023
1 parent 77e9be2 commit b1d35f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 13 additions & 6 deletions src/main/java/net/rptools/maptool/client/AppActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2512,12 +2512,6 @@ protected void executeAction() {

if (chooser.showOpenDialog(MapTool.getFrame()) == JFileChooser.APPROVE_OPTION) {
File campaignFile = chooser.getSelectedFile();
var installDir = AppUtil.getInstallDirectory().toAbsolutePath();
var openDir = campaignFile.toPath().getParent().toAbsolutePath();
if (openDir.startsWith(installDir)) {
MapTool.showWarning("msg.warning.loadCampaignFromInstallDir");
return;
}
loadCampaign(campaignFile);
}
}
Expand Down Expand Up @@ -2552,6 +2546,12 @@ public static void loadCampaign(final File campaignFile) {
return;
}

var installDir = AppUtil.getInstallDirectory().toAbsolutePath();
var openDir = campaignFile.toPath().getParent().toAbsolutePath();
if (openDir.startsWith(installDir)) {
MapTool.showWarning("msg.warning.loadCampaignFromInstallDir");
}

new CampaignLoader(campaignFile).execute();
}

Expand Down Expand Up @@ -2698,6 +2698,13 @@ public static void doSaveCampaign(Runnable onSuccess) {
doSaveCampaignAs(onSuccess);
return;
}
var installDir = AppUtil.getInstallDirectory().toAbsolutePath();
var saveDir = AppState.getCampaignFile().toPath().getParent().toAbsolutePath();
if (saveDir.startsWith(installDir)) {
MapTool.showWarning("msg.warning.saveCampaignToInstallDir");
doSaveCampaignAs(onSuccess);
return;
}
doSaveCampaign(AppState.getCampaignFile(), onSuccess);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2225,10 +2225,8 @@ msg.warn.failedAutoSavingMessageHistory = Could not autosave message histo
msg.warning.macro.playerChangesNotAllowed = The GM has not allowed players to change this macro.
msg.warning.macro.willNotExport = The macro "{0}" will not be exported. Either it has been flagged by the GM as not player editable or you do not have ownership privileges over the source.</body></html>
msg.warning.prerelease.only = Warning {0} is for pre-release testing only and may not be available in the actual release.
msg.warning.loadCampaignFromInstallDir = MapTool does not support loading the campaign \
from the installation directory, please copy the campaign to a different location and try again.
msg.warning.saveCampaignToInstallDir = MapTool does not support saving the campaign \
to the installation directory, please choose a different location.
msg.warning.loadCampaignFromInstallDir = Saving to the installation directory is not supported. After loading you will need to save to a different location.
msg.warning.saveCampaignToInstallDir = Saving to the installation directory, please choose a different location to save to.

msg.error.serverOnly = Function {0} can only be used on the server.

Expand Down

0 comments on commit b1d35f6

Please sign in to comment.