Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-04

lclintf.OpenURL parameter: double quotes or not?

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

Hi all,
(Example on Windows)
OpenURL can be used to open a file on the local machine.

The documentation
http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/openurl.html

says you need to have a valid URL like file://c:\test\bla.pdf

If I have a path with spaces in it and try and open a pdf file, these arguments work:
"file://c:\some path with spaces\some file.pdf"
and
c:\some path with spaces\some file.pdf

This one doesn't:
file://c:\some path with spaces\some file.pdf
(It doesn't open the file, but ShellExecuteW that is called in OpenURL does return a success result code)

Should the file:// URL be surrounded by double quotes? This seems strange as e.g. FileExists and FilexistsUTF8 don't require double quotes. If so, I think the documentation should mention it...

Will double quoting work on other platforms?

See this discussion
http://lazarus.freepascal.org/index.php/topic,16512.0.html on the forum.

Thanks,
Reinier

Reply by email

Reinier Olislagers
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
You should create a bug report (or a patch). The Windows code of OpenURL should detect the spaces and add the quotes.

Thanks, Felipe - what about both a bug report and a patch ;)

I'm admittedly rather poor at reading (or better: understanding) communication, but I hadn't thought ShellExecute needed double quotes..

Ah well... patch created... bug 21659

Thanks,
Reinier

Reply by email

Reinier Olislagers
to Reinier Olislagers
Reinier Olislagers wrote 9 lines
On 6-4-2012 13:30, Felipe Monteiro de Carvalho wrote: > You should create a bug report (or a patch). The Windows code of > OpenURL should detect the spaces and add the quotes. > Thanks, Felipe - what about both a bug report and a patch ;) I'm admittedly rather poor at reading (or better: understanding) communication, but I hadn't thought ShellExecute needed double quotes..

Pfff. ^^^^ documentation....

Reply by email

Bart
to Reinier Olislagers: (Example on Windows) OpenURL can be used to open a file on the local machine. The…
Reinier Olislagers wrote 19 lines
Hi all, (Example on Windows) OpenURL can be used to open a file on the local machine. The documentation http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/openurl.html says you need to have a valid URL like file://c:\test\bla.pdf If I have a path with spaces in it and try and open a pdf file, these arguments work: "file://c:\some path with spaces\some file.pdf" and c:\some path with spaces\some file.pdf This one doesn't: file://c:\some path with spaces\some file.pdf (It doesn't open the file, but ShellExecuteW that is called in OpenURL does return a success result code)

When you use the file:// (or any other) URI scheme, maybe you have to use HTML-escape codes for spaces (and some other characters): file://c:/some%20file%20with%spaces%20in%20the%20filename.pdf

Bart

Reply by email