Public bug reported: using a macro to open an open file dialog and trying to catch the filename and path I get an unusable path. I open the file dialog in the directory where the odb file is (a network place) using: oDBDoc = ThisComponent.Parent oDBDoc = ThisComponent.Parent If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then GlobalScope.BasicLibraries.LoadLibrary("Tools") End If If (oDBDoc.hasLocation()) Then sDocURL = oDBDoc.getURL() uDocPath = DirectoryNameoutofPath(sDocURL, "/") sDocPath = ConvertFromUrl(uDocPath) MsgBox sDocPath Else MsgBox "No running component! Exiting!" End if
msgbox shows: /run/user/1000/gvfs/smb-share:server=fserver,share=XXX/YYY/ZZZ file_dialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker") ucb = createUnoService("com.sun.star.ucb.SimpleFileAccess") AddFiltersToDialog(FilterNames(), file_dialog) 'init_path = ConvertToUrl("/usr") If ucb.Exists(init_path) Then file_dialog.SetDisplayDirectory(uDocPath) End If open_status = file_dialog.Execute() If open_status = 1 Then selectedfile = file_dialog.Files(0) End If file_dialog.Dispose() After selecting in that directory any file the returned name is smb://myservername/myservershare/thenameofthefileinURLnotation ConvertFromUrl returns the exact same filename (with smb and in URL notation). 1 lsb_release -rd Description: Ubuntu 14.04.2 LTS Release: 14.04 2 apt-cache policy libreoffice libreoffice: Εγκατεστημένα: 1:4.2.8-0ubuntu2 Υποψήφιο: 1:4.2.8-0ubuntu2 Πίνακας Έκδοσης: *** 1:4.2.8-0ubuntu2 0 500 http://gr.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages 100 /var/lib/dpkg/status 1:4.2.3~rc3-0ubuntu2 0 500 http://gr.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages ** Affects: libreoffice (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to libreoffice in Ubuntu. https://bugs.launchpad.net/bugs/1466085 Title: open file dialog returns unusable network path Status in libreoffice package in Ubuntu: New Bug description: using a macro to open an open file dialog and trying to catch the filename and path I get an unusable path. I open the file dialog in the directory where the odb file is (a network place) using: oDBDoc = ThisComponent.Parent oDBDoc = ThisComponent.Parent If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then GlobalScope.BasicLibraries.LoadLibrary("Tools") End If If (oDBDoc.hasLocation()) Then sDocURL = oDBDoc.getURL() uDocPath = DirectoryNameoutofPath(sDocURL, "/") sDocPath = ConvertFromUrl(uDocPath) MsgBox sDocPath Else MsgBox "No running component! Exiting!" End if msgbox shows: /run/user/1000/gvfs/smb-share:server=fserver,share=XXX/YYY/ZZZ file_dialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker") ucb = createUnoService("com.sun.star.ucb.SimpleFileAccess") AddFiltersToDialog(FilterNames(), file_dialog) 'init_path = ConvertToUrl("/usr") If ucb.Exists(init_path) Then file_dialog.SetDisplayDirectory(uDocPath) End If open_status = file_dialog.Execute() If open_status = 1 Then selectedfile = file_dialog.Files(0) End If file_dialog.Dispose() After selecting in that directory any file the returned name is smb://myservername/myservershare/thenameofthefileinURLnotation ConvertFromUrl returns the exact same filename (with smb and in URL notation). 1 lsb_release -rd Description: Ubuntu 14.04.2 LTS Release: 14.04 2 apt-cache policy libreoffice libreoffice: Εγκατεστημένα: 1:4.2.8-0ubuntu2 Υποψήφιο: 1:4.2.8-0ubuntu2 Πίνακας Έκδοσης: *** 1:4.2.8-0ubuntu2 0 500 http://gr.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages 100 /var/lib/dpkg/status 1:4.2.3~rc3-0ubuntu2 0 500 http://gr.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1466085/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp