How to get full path of specific folder

asked 2019-11-05 10:51:44 +0100

lonk gravatar image

From dialogs.FilePicker and after selecting a file, I got the file namely :

file:///home/fedora002/Downloads/ER_CSV1_2018-01-15.csv

On the other hand, how to get full path of Linux mandatory of folder namely 'Downloads' :

file:///home/fedora002/Downloads/

in order to attach another file namely e.g. ER_CSV1_2019-10-29.csv next to it ?

| Fedora 31 Workstation KDE of Fedora from Spins | LibreOffice 6.2.8.2-2 |

edit retag flag offensive close merge delete

Comments

This question is not quite clear to me but may be:

Sub CurrentFolder()

 GlobalScope.BasicLibraries.loadLibrary("Tools") 
 dim sURL as String
 dim sPath as String

 sURL = DirectoryNameoutofPath(ThisComponent.getURL(),"/")  REM As URL
 sPath = ConvertFromURL(sURL)                               REM As Path 

End Sub

is what you are looking for.

Opaque gravatar imageOpaque ( 2019-11-05 14:33:06 +0100 )edit

Dear @Opaque ,

MsgBox "sURL = " & sURL & CHR(13) & "sPath = " & sPath

sURL = file:///home/fedora002/Documents/LibreOfficeSampleCode
sPath = /home/fedora002/Documents/LibreOfficeSampleCode

Please let me give more information - User downloads a file from web page and Firefox saves such file into this folder,

file:///home/fedora002/Downloads/

And from your code, can you please help? I'd like to have the results as hereunder:

sURL = file:///home/fedora002/Downloads/
sPath = /home/fedora002/Downloads/
lonk gravatar imagelonk ( 2019-11-06 03:23:23 +0100 )edit