[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" msgid "New project name"
msgstr "" msgstr ""
#: FSaveProjectAs.class:35 #: FSaveProjectAs.class:38
msgid "Cannot save a project inside its own directory." msgid "Cannot save a project inside its own directory."
msgstr "" msgstr ""
#: FSaveProjectAs.class:49 #: FSaveProjectAs.class:63
msgid "Unable to save the project." msgid "Unable to save the project."
msgstr "" msgstr ""

View file

@ -2456,7 +2456,7 @@ Public Sub CopyProject(sSrc As String, sDst As String)
End With End With
Next Next
End End
Public Sub SaveAs() Public Sub SaveAs()
@ -4811,7 +4811,7 @@ Catch
End End
Public Sub CleanUp() Public Sub CleanUp(Optional sDir As String = Project.Dir)
Dim iInd As Integer Dim iInd As Integer
Dim aClear As String[] = [".gambas", ".lock", ".xvpics", "*~", "*.pot", "*.gambas", "core", "core.*", "vgcore.*", ".kdbg*", ".*.prof"] 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] & "\"" sClear &= " -name \"" & aClear[iInd] & "\""
Next Next
Shell "cd " & Shell$(Project.Dir) & "; rm -rf `find . " & sClear & "`" Wait Shell "cd " & Shell$(sDir) & "; rm -rf `find . " & sClear & "`" Wait
Project.Refresh If sDir = Project.Dir Then Project.Refresh
End End

View file

@ -16,6 +16,9 @@ Public Sub btnOK_Click()
Dim sDir As String Dim sDir As String
Dim sName As String Dim sName As String
Dim sMsg As String Dim sMsg As String
Dim aLine As String[]
Dim iCount As Integer
Dim I As Integer
sName = Trim(txtName.Text) sName = Trim(txtName.Text)
sDir = dchProject.Value sDir = dchProject.Value
@ -39,6 +42,17 @@ Public Sub btnOK_Click()
Inc Application.Busy Inc Application.Busy
Project.Save Project.Save
Project.CopyProject(Project.Dir, sDir) 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 Dec Application.Busy
$sNewPath = sDir $sNewPath = sDir
Me.Close(True) Me.Close(True)