On Tue, 24 Mar 2015, rolf wrote:
> Hi,
>
> > I am unable to find the installed or downloaded projects from the
> > software farm, unless they are examples.
> >
> > WHERE ARE THE FILES DOWNLOADED OR INSTALLED TOO?
>
> The gods of Gambas decide to hide this for DEVELOPERS in directories
> below ".local" and they didn't make the path configurable!
>
Mmm, I feel more like an overlord, not a god. *blushes*
Attached is a patch which:
- adds a configuration item to the "Preferences" dialog where you can
select the base directory for software from farms,
- changes every (as far as I and grep know) code, which assumes the hard-
coded path, to work with the configurable one,
- apparently fixes a bug when an "example"-tagged project is downloaded
or installed whose vendor is not "example" and there is no "example"
vendor directory already. (I'll write another mail about that soon.)
It applies to #6997 under app/src/gambas3/. I tested it a few times but
there is no warranty.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
Index: .src/Exported/ProjectChooser/FProjectChooser.class
===================================================================
--- .src/Exported/ProjectChooser/FProjectChooser.class (revision 6997)
+++ .src/Exported/ProjectChooser/FProjectChooser.class (working copy)
@@ -16,7 +16,8 @@
Public Sub Form_Open()
$sLast = ""
- dchProject.Bookmarks = [["Name": ("Installed softwares"), "Path": Desktop.DataDir &/ "gambas3/src", "Icon": "icon:/small/download"]]
+ dchProject.Bookmarks = [["Name": ("Installed softwares"), "Path": Farm.SourceDir, "Icon": "icon:/small/download"]]
+
dchProject.ShowFile = True
dchProject_Change
'tabProject_Click
Index: .src/Options/FOption.class
===================================================================
--- .src/Options/FOption.class (revision 6997)
+++ .src/Options/FOption.class (working copy)
@@ -129,7 +129,8 @@
[txtVendor, "/Packager/Vendor", ""],
[txtLicense, "/Packager/License", "General Public License"],
[txtURL, "/Packager/URL", "www.endoftheinternet.com"],
- [cmbPrefix, "/Packager/UsePrefix", 0]]
+ [cmbPrefix, "/Packager/UsePrefix", 0],
+ [txtBaseDir, "/Farm/BaseDir", Desktop.DataDir &/ "gambas3"]]
$bNoChange = True
@@ -1323,3 +1324,12 @@
RefreshBackground
End
+
+Public Sub txtBaseDir_Click()
+
+ Dialog.Path = txtBaseDir.Text
+ If Dialog.SelectDirectory() Then Return
+ txtBaseDir.Text = Dialog.Path
+ Settings["/Farm/BaseDir"] = IIf(Dialog.Path, Dialog.Path, Farm.DefaultDir)
+
+End
Index: .src/Options/FOption.form
===================================================================
--- .src/Options/FOption.form (revision 6997)
+++ .src/Options/FOption.form (working copy)
@@ -34,7 +34,7 @@
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
- Count = 9
+ Count = 10
Index = 0
Text = ("Identity")
Picture = Picture["icon:/large/identity"]
@@ -945,6 +945,29 @@
}
}
}
+ Index = 9
+ Text = ("Software farm")
+ Picture = Picture["icon:/32/book"]
+ { Label33 Label
+ MoveScaled(1,1,61,3)
+ Font = Font["Bold"]
+ Text = ("Software path")
+ }
+ { HBox35 HBox
+ MoveScaled(1,5,66,4)
+ Spacing = True
+ Indent = True
+ { Label35 Label
+ MoveScaled(0,0,17,4)
+ Expand = True
+ Text = ("Base directory")
+ }
+ { txtBaseDir ButtonBox
+ MoveScaled(20,0,44,4)
+ ReadOnly = True
+ ClearButton = True
+ }
+ }
Index = 0
}
}
Index: .src/Project/CProjectList.class
===================================================================
--- .src/Project/CProjectList.class (revision 6997)
+++ .src/Project/CProjectList.class (working copy)
@@ -67,7 +67,7 @@
Dim sDir As String
Dim hStat As Stat
- sDir = Desktop.DataDir &/ "gambas3/src/example"
+ sDir = Farm.SourceDir &/ "example"
If Not IsDir(sDir) Then Return aList
For Each sFile In Dir(sDir)
Index: .src/Project/Farm/CSoftware.class
===================================================================
--- .src/Project/Farm/CSoftware.class (revision 6997)
+++ .src/Project/Farm/CSoftware.class (working copy)
@@ -166,7 +166,7 @@
Public Sub GetInstalledDir() As String
- Return Desktop.DataDir &/ "gambas3/src" &/ LCase(Vendor) &/ Name
+ Return Farm.SourceDir &/ LCase(Vendor) &/ Name
End
@@ -276,11 +276,9 @@
' Create directories
- sDir = Desktop.DataDir &/ "gambas3"
-
- sSrcDir = sDir &/ "src" &/ LCase(Vendor)
+ sSrcDir = Farm.SourceDir &/ LCase(Vendor)
Project.MakeDir(sSrcDir)
- sExecDir = Desktop.DataDir &/ "gambas3/bin" &/ LCase(Vendor)
+ sExecDir = Farm.BinDir &/ LCase(Vendor)
Project.MakeDir(sExecDir)
' Download source archive
@@ -405,6 +403,7 @@
Endif
If LCase(Vendor) <> "example" And If Tags.Exist("example", gb.IgnoreCase) Then
+ Farm.CreateExampleDir()
Link ".." &/ File.Name(sSrcDir) &/ sName To File.SetName(sSrcDir, "example") &/ sName
Endif
@@ -451,7 +450,7 @@
sDir = GetInstalledDir()
Exec ["rm", "-rf", sDir] Wait
- Try Kill Desktop.DataDir &/ "gambas3/bin" &/ LCase(Vendor) &/ Name & ".gambas"
+ Try Kill Farm.BinDir &/ LCase(Vendor) &/ Name & ".gambas"
Try Kill Desktop.DataDir &/ "applications" &/ "gambas-" & LCase(Vendor) & "-" & Name & ".desktop"
Index: .src/Project/Farm/Farm.module
===================================================================
--- .src/Project/Farm/Farm.module (revision 0)
+++ .src/Project/Farm/Farm.module (working copy)
@@ -0,0 +1,26 @@
+' Gambas module file
+
+Public DefaultDir As String = Desktop.DataDir &/ "gambas3"
+
+Property Read BaseDir As String
+Property Read SourceDir As String
+Property Read BinDir As String
+
+Private Function BaseDir_Read() As String
+ Return Settings["/Farm/BaseDir", DefaultDir]
+End
+
+Private Function SourceDir_Read() As String
+ Return Me.BaseDir &/ "src"
+End
+
+Private Function BinDir_Read() As String
+ Return Me.BaseDir &/ "bin"
+End
+
+Public Sub CreateExampleDir() As Boolean
+
+ Try Mkdir Me.SourceDir &/ "example"
+ Return Error
+
+End
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user