From d8d87547161fdfc4dbc66492ba72cde94f5f753f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 17 May 2014 15:16:12 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Automatically create a ".gitignore" file in the project directory. git-svn-id: svn://localhost/gambas/trunk@6272 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.src/Project.module | 39 ++++++++++++++++++++++++++++- app/src/gambas3/gitignore | 13 ++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 app/src/gambas3/gitignore diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index 4bf6394c9..c6e30b9d3 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -623,7 +623,11 @@ _INIT_AGAIN: ReadProject If Not ReadOnly Then - If Not Exist(Project.Dir &/ ".hidden") Then Project.InsertDirectory(Project.Dir &/ ".hidden") + + If Not Exist(Project.Dir &/ ".hidden") Then InsertDirectory(Project.Dir &/ ".hidden") + + CreateGitIgnore + Endif Dec $iNoRefresh @@ -4983,6 +4987,39 @@ Catch End +Private Sub CreateGitIgnore() + + Dim sPath As String = Project.Dir &/ ".gitignore" + Dim sData As String + Dim iPos As Integer + Dim iPos2 As Integer + + If Not Exist(sPath) Then + Try Copy "gitignore" To sPath + Return + Endif + + sData = File.Load(sPath) + iPos = InStr(sData, "#---- Gambas files to ignore (v1)") + If iPos Then Return + + iPos = InStr(sData, "#---- Gambas files to ignore") + If iPos Then + iPos2 = InStr(sData, "#----", iPos + 5) + If iPos2 Then + iPos2 = InStr(sData, "\n", iPos2) + If iPos2 = 0 Then iPos2 = Len(sData) + 1 + sData = Left(sData, iPos - 1) & Mid$(sData, iPos2) + Endif + Endif + + sData = RTrim(sData) + If sData Then sData &= "\n" + + File.Save(sPath, sData & File.Load("gitignore")) + +End + Public Sub CleanUp(Optional sDir As String = Project.Dir) Dim sFile As String diff --git a/app/src/gambas3/gitignore b/app/src/gambas3/gitignore new file mode 100644 index 000000000..cb95c3b71 --- /dev/null +++ b/app/src/gambas3/gitignore @@ -0,0 +1,13 @@ +#---- Gambas files to ignore (v1) +*.gambas +.lock +*~ +core +core.* +vgcore +vgcore.* +.kdbg* +.*.prof +.lang/*.pot +.gambas/* +#----