1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed folder creation/deletion bugs

This commit is contained in:
Brian Fiete 2020-05-07 05:39:53 -07:00
parent 0b73451502
commit 0edc697e14
2 changed files with 31 additions and 2 deletions

View file

@ -596,7 +596,17 @@ namespace IDE.ui
public void NewFolder(ProjectFolder folder)
{
ProjectFolder projectFolder = new ProjectFolder();
projectFolder.mName.Set("New Folder");
int checkIdx = 0;
while (true)
{
projectFolder.mName.Set("New folder");
if (checkIdx > 0)
projectFolder.mName.AppendF("{}", checkIdx + 1);
if (!folder.mChildMap.ContainsKey(projectFolder.mName))
break;
checkIdx++;
}
projectFolder.mProject = folder.mProject;
projectFolder.mPath = new String();
if (folder.mParentFolder == null)
@ -614,6 +624,14 @@ namespace IDE.ui
}
if (projectFolder.mIncludeKind != .Auto)
projectFolder.mProject.SetChanged();
String fullPath = scope String();
projectFolder.GetFullImportPath(fullPath);
if (Directory.CreateDirectory(fullPath) case .Err(let err))
{
if (err != .AlreadyExists)
gApp.Fail(scope String()..AppendF("Failed to create directory '{]'", fullPath));
}
}
public void NewClass(ProjectFolder folder)
@ -1310,6 +1328,8 @@ namespace IDE.ui
{
if (File.Delete(filePath) case .Ok)
return true;
if (Directory.Delete(filePath) case .Ok)
return true;
fileErrorCount++;
const int maxErrorLen = 4096;