https://foro.gambas-es.org/viewtopic.php?f=5&t=7977&p=47983#p47983
-----------------------------------
cogier
Martes, 21 Abril 2020, 17:50

Re: Estadistica Para Hacer Mas Completa Una Función.
-----------------------------------
Tu código funciona para la Linux Mint. Le eché un vistazo a cómo lo hace Gambas. Aquí está el código IDE de Gambas ligeramente modificado. 

[code linenumbers=false syntax=gambas]
Public Sub Form_Open()

  Dim sAnswer As String = GetDistribution()
  Print sAnswer


End Sub

Public Sub GetDistribution() As String

  Dim cDist As Collection = ["lsb-release": "/etc/lsb-release", "vector": "/etc/vector-version", "slackware": "/etc/slackware-version", "debian": "/etc/debian_version",
    "redhat": "/etc/redhat-release", "arch": "/etc/arch-release", "SuSE": "/etc/os-release", "gentoo": "/etc/gentoo-release", "conectiva": "/etc/conectiva-release",
    "mandriva": "/etc/mandriva-release", "pardus": "/etc/pardus-release", "kanotix": "/etc/kanotix-release"]

  Dim sPath As String
  Dim sDistro As String
  Dim cData As Collection
  Dim iPos As Integer

  For Each sPath In cDist
    sDistro = cDist.Key

    If Not Exist(sPath) Then Continue

    If sDistro = "lsb-release" Then
      cData = ReadLsbRelease(sPath)
      sDistro = cData["DISTRIB_DESCRIPTION"]
      If sDistro Then Return sDistro
      Return cData["DISTRIB_ID"] & " " & cData["DISTRIB_RELEASE"]
    Else
      Return sDistro & " " & Trim(File.Load(sPath))
    Endif

  Next

  If Exist("/etc/issue") Then
    sDistro = File.Load("/etc/issue")
    If sDistro Then
      iPos = InStr(sDistro, "\\")
      If iPos Then sDistro = Left(sDistro, iPos - 1)
    Endif
  Else
    Exec ["uname", "-s"] To sDistro
  Endif
  Return Trim(sDistro)

End

Public Sub ReadLsbRelease(sPath As String) As Collection

  Dim cCol As New Collection
  Dim sLine As String
  Dim aLine As String[]

  For Each sLine In Split(File.Load(sPath), "\n", "", True)

    aLine = Scan(sLine, "*=*")
    Try cCol[aLine[0]] = UnQuote(aLine[1])

  Next

  Return cCol

End
[/code]


