In Basic, simply use the function Dir for an existing file > Returns empty string. Expected output: file name
This code seems to work in LibO3.4beta3: Sub ShowFiles Dim NextFile As String Dim AllFiles As String AllFiles = "" NextFile = Dir("/home/", 16) While NextFile <> "" AllFiles = AllFiles & Chr(13) & NextFile NextFile = Dir Wend MsgBox AllFiles End Sub (Replace /home/ with C:\ on Windows) I.e., the Dir() function applied to a filename returns empty string now. Maybe this should be so?
BTW, in order to list files, 0 should be used in Dir function as the second argument. * 0 : returns normal files * 16 : sub-directories (see http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Files_and_Directories_%28Runtime_Library%29)
Dir(filename) always just worked. In 340beta3 it does not. Adding the argument 0 does not make any difference: still returns an empty string.
(In reply to comment #3) > Dir(filename) always just worked. In 340beta3 it does not. > > Adding the argument 0 does not make any difference: still returns an empty > string. afaics it's a bug, trying to find out what changed
At a later moment, I was running gdb when using Dir() FWIW, the output: Program received signal SIGPIPE, Broken pipe. 0xb7fe1424 in __kernel_vsyscall ()
fixed on libreoffice-3.4 http://cgit.freedesktop.org/libreoffice/libs-core/commit/?h=libreoffice-3-4&id=4e019509ca8a17a81f71141157ed240ed827fccb
(In reply to comment #5) > At a later moment, I was running gdb when using Dir() > > FWIW, the output: > Program received signal SIGPIPE, Broken pipe. > 0xb7fe1424 in __kernel_vsyscall () I would guess unrelated :-)
thanks Noël !