From 7095e599e7aa09a2a981fa26534f8a50af01e26c Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 8 Nov 2011 14:07:01 +0000 Subject: [PATCH] IDE: newfile: check if there is a directory with this file name git-svn-id: trunk@33417 - --- ide/lazarusidestrconsts.pas | 3 +++ ide/main.pp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 630f76c701..663a8b6fb6 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -5366,6 +5366,9 @@ resourcestring lisDiscardChangesAndQuit = 'Discard changes and quit'; dbgBreakPropertyGroupNotFound = 'Some groups in the Enable/Disable list do not exist.%0:s' +'Create them?%0:s%0:s%1:s'; + lisFileIsDirectory = 'File is directory'; + lisUnableToCreateNewFileBecauseThereIsAlreadyADirecto = 'Unable to create ' + +'new file, because there is already a directory with this name.'; implementation diff --git a/ide/main.pp b/ide/main.pp index 9fb49e08d9..e70afd6e19 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -8542,6 +8542,14 @@ begin end; end; + if FilenameIsAbsolute(NewFilename) and DirectoryExistsUTF8(NewFilename) then + begin + IDEMessageDialog(lisFileIsDirectory, + lisUnableToCreateNewFileBecauseThereIsAlreadyADirecto, + mtError,[mbCancel]); + exit(mrCancel); + end; + if NewOwner is TProject then AProject:=TProject(NewOwner) else