I have a service which refers to some external filesystem resources like html, css, etc, ... which fails to load in Windows because of passing incorrect path to them.
Is there any way I could retrieve the file separator of the operating system in Qorus (I mean slash or backslash depending on the system) so that I could build the proper resource path?
I know there is a function to get the path of a file normalize_dir() and based on it can be decided what separator to use
string file_separator = normalize_dir("").find("/") > 0 ? '/' : '\';
setDefaultResource("html" + file_separator + "index.qhtml");
but I was wondering if there is already something in place that return this char (as I was not able to find something similar in the docs) or a similar function that I could reuse.
You can use Qore string constant DirSep
described in documentation, which always contains the platform-specific directory separator string, i.e. /
for Linux and other Unix-like OSes, and \
for Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With