specialFolderPaths("documents") returns empty string on linux LXLE
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
specialFolderPaths("documents") returns empty string on linux LXLE
specialFolderPaths() docs (that I've found so far) indicate it should work for Linux, but I notice all the examples I keep seeing are for the other platforms. Is there a list of the subset of special paths that is supported on Linux?
specialFolderPaths("User") I would have expected to work even on Linux, but nothing so far; just returns empty string as with "documents".
specialFolderPaths("home") *does* return the home folder, so I can work with that, but I'm still curious: where is the documentation page I'm missing that lists specifically which special names work for this function in Linux?
Also, has anyone run into distribution idiosyncrasies on this particular function? I'm wondering if LXLE might be just different enough to throw off internal assumptions.
specialFolderPaths("User") I would have expected to work even on Linux, but nothing so far; just returns empty string as with "documents".
specialFolderPaths("home") *does* return the home folder, so I can work with that, but I'm still curious: where is the documentation page I'm missing that lists specifically which special names work for this function in Linux?
Also, has anyone run into distribution idiosyncrasies on this particular function? I'm wondering if LXLE might be just different enough to throw off internal assumptions.
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Hi slowmaker,
welcome to the forum!
It is spelled -> specialfolderpath() with no trailing S
Please scroll down to the bottom of the entry for "specialfolderpath" in the dictionary,
where you will magically find all supported specialfolderpath() codes for LINUX.
specialfolderpath("documents") is not supported on Linux, as you will see.
Best
Klaus
P.S.
A little "Hello" or something will surely not hurt for a first posting.
welcome to the forum!
It is spelled -> specialfolderpath() with no trailing S
Please scroll down to the bottom of the entry for "specialfolderpath" in the dictionary,
where you will magically find all supported specialfolderpath() codes for LINUX.
specialfolderpath("documents") is not supported on Linux, as you will see.
Best
Klaus
P.S.
A little "Hello" or something will surely not hurt for a first posting.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: specialFolderPaths("documents") returns empty string on linux LXLE
"~/Documents" will work.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Thanks! Aggravatingly enough, I had read the same info -- twice -- in the documentation tab within the code editor, but had managed to scroll past the word Linux every time without catching it. I should pay more attention to the 'Less haste, more speed' adage.
Too late for first posting; does second post not-hurt less or more?
Yep, typo in the post; spelled it right in actual usage (otherwise the "home" call would presumably not have worked).
Hello!
Too late for first posting; does second post not-hurt less or more?
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Not on mine so far. I'll have to play with it more later, thanks for the suggestion.
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Well, for sure
put specialfolderpath("Home") & "/Documents"
or
put specialfolderpath("Home") & "/Documents/"
will work
Play with those in the message box to get the feel of it.
put specialfolderpath("Home") & "/Documents"
or
put specialfolderpath("Home") & "/Documents/"
will work
Play with those in the message box to get the feel of it.
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Nope. I should probably point out that I do not have a folder called Documents in my home folder. (mine is just "doc").
So hard-coded assumptions like that will not work.
I should also acknowledge *my* error of assumption: when FourthWorld suggested "~/Documents", I read too quickly and thought they meant to put that in as the argument to specialFolderPath(). I realize now they were probably suggesting I just hardcode it.
However, as noted above, that folder path assumption won't really work, because there are those of us, like me, who change their default docs folder.
What I was hoping for was that Livecode might have some magic going on that allowed it to query the system to find out what the default folders were set to. For instance, on ubuntu & co (like LXLE, the distro I use), one will have the option to call
Code: Select all
xdg-user-dir DOCUMENTS
This approach would work an anything using Freedesktop (you'll have to google it, the forum won't allow me to insert a link) utilities for that part of its setup. I don't know what percentage of Linux distros that would come to, though; could be this is one of those things that just varies too much to be reasonable for the livecode team to try to cover.
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
Re: specialFolderPaths("documents") returns empty string on linux LXLE
You *can* do that too There are lots of ways to do what your looking to do, including using OS calls to accomplish your goals.slowmaker wrote: ↑Fri Feb 08, 2019 6:41 pmWhat I was hoping for was that Livecode might have some magic going on that allowed it to query the system to find out what the default folders were set to. For instance, on ubuntu & co (like LXLE, the distro I use), one will have the option to call
[xdg-user-dir DOCUMENTS]
and get the correct return value, even on a modded system like mine. The above returns /home/slowmaker/doc in my case.
It will in 6 more posts for you
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Do you not have a Documents folder in your Home directory?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: specialFolderPaths("documents") returns empty string on linux LXLE
FourthWorld wrote: ↑Fri Feb 08, 2019 11:13 pmDo you not have a Documents folder in your Home directory?
Which is why I pointed out shell to slowmaker
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: specialFolderPaths("documents") returns empty string on linux LXLE
No ~/Documents?
How would one use a function to get the path to a folder which does not exist?
How would one use a function to get the path to a folder which does not exist?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: specialFolderPaths("documents") returns empty string on linux LXLE
ah, but a folder designated as the-official-spot-for-documents *does* exist; it just happens to not be called Documents in some cases.FourthWorld wrote: ↑Sat Feb 09, 2019 5:19 amNo ~/Documents?
How would one use a function to get the path to a folder which does not exist?
think of it as similar to the aims of specialFolderPath() itself; the point is to put in a generic name and get back a specific path which the system claims is used for the same purpose.
thus, calls to xdg-usr-dir can have returns like so:
Code: Select all
slowmaker@babybel:~$ xdg-user-dir USER
/home/slowmaker
slowmaker@babybel:~$ xdg-user-dir DOCUMENTS
/home/slowmaker/doc
slowmaker@babybel:~$ xdg-user-dir DOWNLOAD
/home/slowmaker/eval
slowmaker@babybel:~$ xdg-user-dir PICTURES
/home/slowmaker/pic
slowmaker@babybel:~$ xdg-user-dir VIDEOS
/home/slowmaker/vid
slowmaker@babybel:~$ xdg-user-dir MUSIC
/home/slowmaker/audio/music
A Linux distribution using FreeDesktop utilities would have a per user config file at ~/.config/user-dirs.dirs.
for example:
Code: Select all
slowmaker@babybel:~$ cat ~/.config/user-dirs.dirs
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/eval"
XDG_TEMPLATES_DIR="$HOME/templates"
XDG_PUBLICSHARE_DIR="$HOME/pub"
XDG_DOCUMENTS_DIR="$HOME/doc"
XDG_MUSIC_DIR="$HOME/audio/music"
XDG_PICTURES_DIR="$HOME/pic"
XDG_VIDEOS_DIR="$HOME/vid"
I'll post it here for future perusal by like-minded-oddballs; since I'm quite new to LiveCode syntax and coding conventions, I'm sure it will have rough edges that need sanding off. I would appreciate your input on that when the time comes.
(edited for typo)
(edited for phrasing; I realized the phrase 'like-me's' looked a bit like someone hungering for little gold stars stuck on their forehead! not what I intended, so I modified it a bit)
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
Re: specialFolderPaths("documents") returns empty string on linux LXLE
one more quick note on this, for others who may be interested in the internals of specialFolderPath():
I changed my desktop folder to just 'desk'. Afterward:
but specialFolderPath("desktop"), running in the Message Box from a livecode session initiated from the same terminal instance as the above (and all this is after a reboot, just to be safe), still returns
So for Linux, it appears (below is speculation based on behavior, I have no way of knowing the internals for sure):
specialFolderPath("desktop") = "$HOME/Desktop" -- not necessarily correct, just returning a hard-coded path.
specialFolderPath("user") = correct, probably checking $HOME for the "user" path
specialFolderPath("temporary") = "/tmp" -- another hard-coded path; this one is actually a fairly solid standard, as it is required by the Filesystem Hierarchy Standard of the Linux Foundation.
Gotta get to work now at actual paying job...
I changed my desktop folder to just 'desk'. Afterward:
Code: Select all
slowmaker@babybel:~$ xdg-user-dir DESKTOP
/home/slowmaker/desk
Code: Select all
/home/slowmaker/Desktop
specialFolderPath("desktop") = "$HOME/Desktop" -- not necessarily correct, just returning a hard-coded path.
specialFolderPath("user") = correct, probably checking $HOME for the "user" path
specialFolderPath("temporary") = "/tmp" -- another hard-coded path; this one is actually a fairly solid standard, as it is required by the Filesystem Hierarchy Standard of the Linux Foundation.
Gotta get to work now at actual paying job...
The important thing is not to stop questioning. Curiosity has its own reason for existence. - Albert Einstein (LIFE Magazine (1955 may 2), p64)
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: specialFolderPaths("documents") returns empty string on linux LXLE
Thanks for the reminder about those FreeDesktop.org constants, slowmaker. I've filed a bug report on this:
https://quality.livecode.com/show_bug.cgi?id=21832
https://quality.livecode.com/show_bug.cgi?id=21832
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: specialFolderPaths("documents") returns empty string on linux LXLE
I think he means you, slowmakerFourthWorld wrote: ↑Sun Feb 10, 2019 4:58 amThanks for the reminder about those FreeDesktop.org constants, Bogs.