[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
This commit is contained in:
Benoît Minisini 2012-09-17 13:41:50 +00:00
parent 0f985417cf
commit 22a119f0a6
3 changed files with 20 additions and 6 deletions

View file

@ -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 ""

View file

@ -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

View file

@ -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)