File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
src/main/java/com/bobrust Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public static void main(String[] args) {
2525 LOGGER .info (" Lwjgl : {}" , hasLwjgl );
2626 LOGGER .info ("" );
2727
28+ // TODO: Make sure logs and properties can be saved without admin rights.
2829 // TODO: Do not draw outside the image region +- the radius of the largest shape.
2930 // TODO: Maybe remove the monitor button and only make it choose the screen you
3031 // expanded the window on?
Original file line number Diff line number Diff line change 55import java .util .Objects ;
66import java .util .Properties ;
77
8+ import javax .swing .JOptionPane ;
9+
810import org .apache .logging .log4j .LogManager ;
911import org .apache .logging .log4j .Logger ;
1012
@@ -76,7 +78,7 @@ protected void loadSettings() {
7678 setSettingsAutosaveInterval (getSettingInteger (Settings .SETTINGS_AUTOSAVE_INTERVAL ));
7779
7880 allowSaving = true ;
79- saveSettings ();
81+ saveSettings (true );
8082 }
8183
8284 private Integer getSettingInteger (Settings key ) {
@@ -105,11 +107,25 @@ private String getSettingsProperty(Settings key) {
105107 }
106108
107109 private void saveSettings () {
110+ saveSettings (false );
111+ }
112+
113+ private void saveSettings (boolean giveMessage ) {
108114 if (!allowSaving ) return ;
109115
110116 try (FileOutputStream stream = new FileOutputStream (CONFIG_FILE )) {
111117 properties .store (stream , "" );
112118 } catch (IOException e ) {
119+ if (giveMessage ) {
120+ JOptionPane .showMessageDialog (
121+ null ,
122+ "This tool does not have the permission to update the config file\n " +
123+ "Try run the application as an Administrator if you want to fix this" ,
124+ "Importaint" ,
125+ JOptionPane .WARNING_MESSAGE
126+ );
127+ }
128+
113129 LOGGER .error ("Error saving config file: {}" , e );
114130 LOGGER .throwing (e );
115131 e .printStackTrace ();
Original file line number Diff line number Diff line change 1- # Sat Nov 13 00:10:45 CET 2021
2- build_id =41
1+ # Thu Jan 13 19:31:44 CET 2022
2+ build_id =45
You can’t perform that action at this time.
0 commit comments