Dokumentaro de Gambaso
Compilation & Installation from source code
Components
gb
gb.crypt
gb.qt4
Documents
Indekso de Lingvo
Language Overviews
LeguMin
Lexicon
Registro

DesktopMime.FromFile (gb.desktop)

Static Function FromFile ( Path As String ) As DesktopMime

  • Path

Creates a DesktopMime object from the given file Path

'' Example, get a files mimetype..

    Public Sub GetMimeType(sFilePath As String) As String

      Dim hMime As DesktopMime

      hMime = DesktopMime.FromFile(sFilePath)

      Return hMime.Type

    End

Warning: this command is for use on files only.

A directory will not return the expected inode/directory mimetype as it is not a file so you should make the distinction yourself.

'' Example, get a mimetype for file or directory..

    Public Sub GetMimeType(sFilePath As String) As String

      Dim hMime As DesktopMime

      If IsDir(sFilePath) Then Return "inode/directory"

      hMime = DesktopMime.FromFile(sFilePath)

      Return hMime.Type

    End