Resource folder path

Is there a way to get the resource path folder from the command line or some other way in the terminal?

On what operating system? Cause there is always the find command. You can search for a file that goes into the resource folder like KRITA_RESOURCE_VERSION

Yeah well I should have been more specific. I mean by invoking the krita program with a command line option (e.g. krita --print-resource-path) or some other way using the krita app.

Can you clarify what your use case is? Maybe that would be more clear. I don’t think the command line app itself has that option. But if you simply need it within Krita itself, there is the python API…

Yea, that doesn’t help me, I want to make an install script and I don’t want to hard code the paths. It’s fine if Krita can’t print it, maybe one day it will.

So why is the find command not an option then?

The path it puts them are also generally dependent on your platform. So you would only have to code based on the platform + ENV variables to get the path.

That’s kind of like asking “Why isn’t enough to program in assembler?”. Because of convenience of course.

I’m disturbed…

An installation script, for Krita?
But if krita isn’t yet installed, how can command krita --print-resource-path could work?
What you’re trying to do is not clear :slight_smile:

Also, without knowledge of system/langage you’re working on, that hard to give you answers…

Krita path are defined here:

Grum999

The paths go into standard directories. So not sure how it is “convenient” to not simply hard code them unless:
A) You want to future proof things just in case there is some major OS changes on where the home directory is
B) You expect the user to modify something

Otherwise, its overengineering

Well, if you are on linux, the easiest is the appimage. You simply make 2 folders with same name as the appimage and .config and .home at end and it will put the resource folder in there.

I know how to code this, I’m not here to debate or figure out how to code it. I just had a simple question - can krita do it or not. Seem like the answer is no, that’s fine. Maybe one day it will or not, I don’t care that much.

Other users were trying to help you, for that knowing the usecase and evaluating workarounds is sometimes the best option…

In any case, for Krita 4.4.5 and earlier, the paths were hard-coded for every system. For Krita 5.0, there is a setting for that, so you can parse the configuration file (which is in an hard-coded place).

For the earlier versions, if you have Qt there - by PyQt or something - you can get access to the path using QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);to get the standard location.

If you want Krita to tell it to you, you can create a python script that gets this information and then run Krita (or Kritarunner, I think?) to run this script. For Krita 4.4.5 and below, you can just use QStandardPaths in the plugin since you’d need PyQt anyway, and for Krita 5.0 and above, there is Krita::readSetting function to get the value of the resource folder location. The key is "ResourceDirectory", and the group is "".