From 22a119f0a6c8cebe8d50825cda1de7d8a67d392a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 17 Sep 2012 13:41:50 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * BUG: When saving a project with another name, the ExecPath and SourcePath options of the target project are reset, and the target project is cleaned up. git-svn-id: svn://localhost/gambas/trunk@5172 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.lang/.pot | 4 ++-- app/src/gambas3/.src/Project.module | 8 ++++---- app/src/gambas3/.src/Project/FSaveProjectAs.class | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) 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)