https://bugs.documentfoundation.org/show_bug.cgi?id=99742

            Bug ID: 99742
           Summary: Hashtag in path name or file name causing error
           Product: LibreOffice
           Version: 5.1.3.1 rc
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Hello,

below there's a short macro that creates a TXT file with a bit of content.
If you use path names that contain a hashtag either in the path or in the file
name, you will find the macro fail and produce an error message:
"BASIC-Laufzeitfehler. [= german for: Basic runtime error]
 Es ist eine Ausnahme aufgetreten [= german for: An exception has occured]
 Type: com.sun.star.ucb.ContentCreationException
 Message: Unable to create Content for <file:///D:/#/Test.txt>: ."
Using an URL without any hashtag, the macro will work fine.

I have found this error in LibO 5.1.3.2 but not in LibO 5.0.5.

Sub Main
    Dim oFileAccess, oFileOutput, sFileUrl As String, sText As String
    sText = "This is a piece oft text."
    sFileUrl = "file:///D:/#/Test.txt"   '=> error message.
    'sFileUrl = "file:///D:/#a/Test.txt"    '=> error message.
    'sFileUrl = "file:///D:/a/#Test.txt"    '=> error message.
    'sFileUrl = "file:///D:/a/Test.txt"     '=> No error message.
    oFileAccess = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
    oFileOutput = CreateUnoService("com.sun.star.io.TextOutputStream")
    oFileOutput.SetOutputStream(oFileAccess.OpenFileWrite(sFileUrl))
    oFileOutput.WriteString(sText & Chr(13) & Chr(10))
    oFileOutput.CloseOutput()
    Print "Done"
End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to