File tree Expand file tree Collapse file tree
main/src/main/java/org/xedox/webaide/project Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,11 +89,17 @@ public String file(String path) {
8989 return new File (projectPath , path ).getAbsolutePath ();
9090 }
9191
92- public static void renameProject (Project project , String newName ) {
93- File newFile = new File (project .getParent (), newName );
94- new File (project .getAbsolutePath ()).renameTo (newFile );
92+ public static Project renameProject (Project project , String newName ) throws IOException {
93+ File oldFile = new File (project .getAbsolutePath ());
94+ File newFile = new File (project .getParent (), newName );
95+
96+ if (!oldFile .renameTo (newFile )) {
97+ throw new IOException ("Failed to rename project." );
9598 }
9699
100+ return new Project (newFile );
101+ }
102+
97103 public static void removeProject (Project project ) {
98104 project .projectPath .deleteRecursively ();
99105 }
You can’t perform that action at this time.
0 commit comments