Populate combobox with mkfs.*

Post

Posted
Rating:
#1 (In Topic #1359)
Regular
theyikes is in the usergroup ‘Regular’
 I'm back!!! Yup yet another question about populating list boxes and Combo boxes. This time i need help add all mkfs* filesystems. I can do it in the terminal but i can't seem to do it in Gambas3. Essentially i would like to be able to add all the file systems for mkfs into a combobox or even a listbox.

is this difficult?

I'd love some advice.
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
theyikes is in the usergroup ‘Regular’
 In the terminal it's simple, just type mkfs (tab tab) but i have no idea how to incorporate that into gambas.
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
theyikes is in the usergroup ‘Regular’
or should i just add them 1 by 1 on open?
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
theyikes is in the usergroup ‘Regular’
 okay i gave up, I don't doubt it can be done, just not by me. I did it manually and it works fine. But i'd still like to know if there's an alternative method.
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
By hitting Tab in a terminal you are searching the system PATH for mkfs* and bash shows you the results.

it does not "list mkfs filesystems" as such but it lists all found mkfs* binaries in $PATH (probably in /usr/sbin)
ls /usr/sbin/mkfs.*
one way to do that in gambas is like this…

Code (gambas)

  1.  
  2. ' find mkfs in in one of the system PATH paths.
  3. For Each sPath As String in Split(Env["PATH"], ":")
  4.   if Exist(sPath &/ "mkfs") then
  5.     sDir = sPath
  6.     Break
  7.  
  8. If sDir Then ComboBox1.List = Dir(sDir, "mkfs.*").Sort()
  9.  
  10.  
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
Oops in the above code i mistakenly wrote mkdir instead of mkfs :-\
I just corrected it.


But here's another way using System.Find to get the path of mkfs then Dir the folder

Code (gambas)

  1.  
  2.   Dim sDir As String = System.Find("mkfs")
  3.   If sDir Then ComboBox1.List = Dir(File.Dir(sDir), "mkfs.*").Sort()
  4.  
  5.  
Online now: No Back to the top
1 guest and 0 members have just viewed this.