Bug 36898 - Dir(<name existing file>) returns empty string
Summary: Dir(<name existing file>) returns empty string
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.4.0 Beta3
Hardware: Other All
: high normal
Assignee: Noel Power
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: mab3.4
  Show dependency treegraph
 
Reported: 2011-05-06 02:42 UTC by Cor Nouws
Modified: 2011-05-06 07:06 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cor Nouws 2011-05-06 02:42:54 UTC
In Basic, simply use the function Dir for an existing file
 > Returns empty string.
Expected output: file name
Comment 1 clio 2011-05-06 03:29:36 UTC
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?
Comment 2 clio 2011-05-06 03:34:13 UTC
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)
Comment 3 Cor Nouws 2011-05-06 04:47:51 UTC
Dir(filename) always just worked. In 340beta3 it does not.

Adding the argument 0 does not make any difference: still returns an empty string.
Comment 4 Noel Power 2011-05-06 05:12:05 UTC
(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
Comment 5 Cor Nouws 2011-05-06 06:15:38 UTC
At a later moment, I was running gdb when using Dir()

FWIW, the output:
  Program received signal SIGPIPE, Broken pipe.
  0xb7fe1424 in __kernel_vsyscall ()
Comment 7 Noel Power 2011-05-06 06:53:11 UTC
(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 :-)
Comment 8 Cor Nouws 2011-05-06 07:06:36 UTC
thanks Noël !