Jump to content

AppDataPath()


brndx
 Share

Recommended Posts

From what it looks like, it seems like your making a new directory under root. I recall LE storing the AppData folder under /home/USER/. The user doesn't have permission to access anything outside their home folder by default. Also, the folder is hidden with a period at the start.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Actually, for linux "~" doesn't have any meaning at all... expanding "~" to the current user's home-directory is a feature of most shells (bash, zsh, ...). This means, if you type "~" in the terminal, the shell that is executing in the terminal replaces this by the user's home-directory. However, if you try to use "~" from your program, it will not mean anything to linux and your program can't do anything with it.

Look at the following example-terminal session:

$ echo foo > ~/bar
$ cat ~/bar
foo
$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open("~/bar")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '~/bar'
>>> f = open("/home/user/bar")
>>>

As you can see, e.g. Python can't find the file "~/bar", since "~" doesn't mean anything to it. Using the complete path, however, works.

The same would hold for your Leadwerks LUA/C++ project: You can't use "~" to refer to the current user's home directory. Using the result of getenv("HOME"), as Josh mentioned, is the correct way to get the home-directory. (And yes, for the SHELL it is equivalent to "~/", but for your program)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...