diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index de0d5b7d6..27d357445 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -3970,11 +3970,11 @@ msgstr "" msgid "New project name" msgstr "" -#: FSaveProjectAs.class:35 +#: FSaveProjectAs.class:38 msgid "Cannot save a project inside its own directory." msgstr "" -#: FSaveProjectAs.class:49 +#: FSaveProjectAs.class:63 msgid "Unable to save the project." msgstr "" diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index 4cb9e56c5..3dc7b5367 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -2456,7 +2456,7 @@ Public Sub CopyProject(sSrc As String, sDst As String) End With Next - + End Public Sub SaveAs() @@ -4811,7 +4811,7 @@ Catch End -Public Sub CleanUp() +Public Sub CleanUp(Optional sDir As String = Project.Dir) Dim iInd As Integer Dim aClear As String[] = [".gambas", ".lock", ".xvpics", "*~", "*.pot", "*.gambas", "core", "core.*", "vgcore.*", ".kdbg*", ".*.prof"] @@ -4822,8 +4822,8 @@ Public Sub CleanUp() sClear &= " -name \"" & aClear[iInd] & "\"" Next - Shell "cd " & Shell$(Project.Dir) & "; rm -rf `find . " & sClear & "`" Wait - Project.Refresh + Shell "cd " & Shell$(sDir) & "; rm -rf `find . " & sClear & "`" Wait + If sDir = Project.Dir Then Project.Refresh End diff --git a/app/src/gambas3/.src/Project/FSaveProjectAs.class b/app/src/gambas3/.src/Project/FSaveProjectAs.class index 141580f85..9f48c774c 100644 --- a/app/src/gambas3/.src/Project/FSaveProjectAs.class +++ b/app/src/gambas3/.src/Project/FSaveProjectAs.class @@ -16,6 +16,9 @@ Public Sub btnOK_Click() Dim sDir As String Dim sName As String Dim sMsg As String + Dim aLine As String[] + Dim iCount As Integer + Dim I As Integer sName = Trim(txtName.Text) sDir = dchProject.Value @@ -39,6 +42,17 @@ Public Sub btnOK_Click() Inc Application.Busy Project.Save Project.CopyProject(Project.Dir, sDir) + + aLine = Split(File.Load(sDir &/ ".project"), "\n") + iCount = aLine.Count + I = aLine.Find("ExecPath=*", gb.Like) + If I >= 0 Then aLine.Remove(I) + I = aLine.Find("SourcePath=*", gb.Like) + If I >= 0 Then aLine.Remove(I) + If aLine.Count <> iCount Then File.Save(sDir &/ ".project", aLine.Join("\n")) + + Project.CleanUp(sDir) + Dec Application.Busy $sNewPath = sDir Me.Close(True)