Przeglądaj źródła

tools: determine final path *before* doing sanity checks on it

Daniele Bartolini 5 lat temu
rodzic
commit
bbb94ba4bf
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      tools/level_editor/level_editor.vala

+ 5 - 1
tools/level_editor/level_editor.vala

@@ -1270,6 +1270,10 @@ public class LevelEditorApplication : Gtk.Application
 				}
 				}
 				path = fcd.get_filename();
 				path = fcd.get_filename();
 
 
+				// Append file extension
+				if (!path.has_suffix(".level"))
+					path += ".level";
+
 				// Check if the file is within the source directory
 				// Check if the file is within the source directory
 				if (!_project.path_is_within_dir(path, _project.source_dir()))
 				if (!_project.path_is_within_dir(path, _project.source_dir()))
 				{
 				{
@@ -1308,7 +1312,7 @@ public class LevelEditorApplication : Gtk.Application
 			fcd.destroy();
 			fcd.destroy();
 		}
 		}
 
 
-		_level.save(path.has_suffix(".level") ? path : path + ".level");
+		_level.save(path);
 		_statusbar.set_temporary_message("Saved %s".printf(_level._path));
 		_statusbar.set_temporary_message("Saved %s".printf(_level._path));
 		return true;
 		return true;
 	}
 	}