[Gambas-user] stat bug?

Tobias Boege taboege at ...626...
Mon May 6 19:46:44 CEST 2013


On Mon, 06 May 2013, paulwheeler wrote:
> 
>    I have many files with spaces in the name. However, this causes the message
>    "File or directory does not exist" when using stat. Works fine for files
>    that do not have spaces in the name. I even tried adding quotes to the
>    string, but still get same message.
>    Using Gambas 3.4.1 on this system:
>    [System]
>    OperatingSystem=Linux
>    Kernel=3.8.0-19-generic
>    Architecture=x86_64
>    Distribution=Ubuntu 13.04
>    Desktop=XFCE
>    Theme=QGtk
>    Language=en_US.UTF-8
>    Memory=7860M
>    [Libraries]
>    GStreamer=libgstreamer-0.10.so.0.30.0
>    GTK+=libgtk-x11-2.0.so.0.2400.17
>    Qt4=libQtCore.so.4.8.4
>    SDL=libSDL-1.2.so.0.11.4
>    Poppler=libpoppler.so.28.0.0
>    Public Sub Button1_Click()
>      Dim txtSelectedPath As String
>      FileChooser1.Filter = ["*.txt", "Text Files", "*", "All files"]
>      FileChooser1.Dir = User.Home
>      Print InStr(FileChooser1.SelectedPath, " ")
> 
>      If InStr(FileChooser1.SelectedPath, " ") <> 0 Then
>              Print "inside instr <> 0"
>         txtSelectedPath = Quote$(FileChooser1.SelectedPath)
>        ' Print txtSelectedPath
>       Else
>           Print "inside instr else"
>         txtSelectedPath = FileChooser1.SelectedPath
>      Endif
>     Print txtSelectedPath
> 
>      With Stat("/home/paul/Gospel Art Kit 1-tif.odt")
>     ' With Stat(txtSelectedPath)
>        ListBox1.Add(.Size)
>        ListBox1.Add(.LastModified)
>        ListBox1.Add(.Path)
>        ListBox1.Add(.User)
>        Print "done with stat"
>      End With
>    End

Not a problem on my system:

With Stat("/home/tab/file with space")
	Print .Size
	Print .User
End With

works as expected (Gambas 3 trunk) if "file with space" exists. Note that
adding quotes to the path would make it even worse as quotes are permitted
in file names (so they will be taken as part of the name whatsoever and not
quote anything).

Regards,
Tobi




More information about the User mailing list