[DEVELOPMENT ENVIRONMENT]
* BUG: Renaming a edited form works correctly now. * NEW: Project are now locked with the LOCK instruction, not with files. Consequently, if the IDE crashes, the edited project is automatically unlocked. git-svn-id: svn://localhost/gambas/trunk@2342 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
083eaf8f6a
commit
4ac4e570c9
2 changed files with 18 additions and 7 deletions
|
@ -774,7 +774,10 @@ Public Function Rename(sNewName As String) As Boolean
|
|||
If hForm.Control.Exist(sNewName) Then Return True
|
||||
Endif
|
||||
|
||||
hForm.GetEditor(True).RenameControl(Name, sNewName)
|
||||
' Don't look in the class when renaming the form!
|
||||
If Parent Then
|
||||
hForm.GetEditor(True).RenameControl(Name, sNewName)
|
||||
Endif
|
||||
|
||||
If Name Then hForm.Control[Name] = Null
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ Private $cSourceDir As Collection
|
|||
|
||||
Private $hCurrentPopup As Menu
|
||||
|
||||
Private $hLock As File
|
||||
|
||||
Public Sub _init()
|
||||
|
||||
|
@ -298,6 +299,7 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
|
|||
Dim bSave As Boolean
|
||||
Dim sVer As String
|
||||
Dim sFile As String
|
||||
Dim hLock As Stream
|
||||
|
||||
If Not Exist(sDir &/ ".project") Then
|
||||
FGambas.Error(("This project does not exist.") & "\n\n" & sDir)
|
||||
|
@ -324,7 +326,9 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
|
|||
Endif
|
||||
Endif
|
||||
|
||||
If Exist(sDir &/ ".lock") Then
|
||||
Try hLock = Lock sDir &/ ".lock"
|
||||
|
||||
If Not hLock Then
|
||||
If Message.Warning(("This project seems to be already opened.\n\nOpening the same project twice can lead to data loss."),
|
||||
("Open after all"), ("Do not open")) = 2 Then
|
||||
Return True
|
||||
|
@ -333,8 +337,6 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
|
|||
|
||||
If CloseProject() Then Return True
|
||||
|
||||
Try Kill sDir &/ ".lock"
|
||||
|
||||
ReadOnly = Not Access(sDir, gb.Write)
|
||||
If Not ReadOnly Then
|
||||
If Exist(sDir &/ ".startup") And If Not Access(sDir &/ ".startup", gb.Write) Then ReadOnly = True
|
||||
|
@ -391,8 +393,8 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
|
|||
'FExplorer.ProjectChange
|
||||
Design.Clear
|
||||
Design.ReadBreakpoints
|
||||
|
||||
Try File.Save(sDir &/ ".lock", "")
|
||||
|
||||
$hLock = hLock
|
||||
|
||||
LastOpenedFiles
|
||||
|
||||
|
@ -409,6 +411,8 @@ Catch
|
|||
|
||||
_CANCEL:
|
||||
|
||||
If hLock Then Try Unlock #hLock
|
||||
|
||||
Path = sOldPath
|
||||
Project.Dir = File.Dir(Path)
|
||||
Name = sOldName
|
||||
|
@ -521,7 +525,11 @@ Private Function CloseProject() As Boolean
|
|||
Files.Clear
|
||||
ActiveForm = Null
|
||||
|
||||
Try Kill Project.Dir &/ ".lock"
|
||||
If $hLock Then
|
||||
Unlock #$hLock
|
||||
Try Kill Project.Dir &/ ".lock"
|
||||
$hLock = Null
|
||||
Endif
|
||||
|
||||
Dec Application.Busy
|
||||
|
||||
|
|
Loading…
Reference in a new issue