# Getting Ignition Root Folder

**URL:** <https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 7, 2024, 8:55am UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004 "2024-05-07T08:55:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [May 7, 2024, 8:55am UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/1 "2024-05-07T08:55:11Z")

</div>

Hello!

Right now I'm working doing a script that acces some local files, specically some json schemas so I can check the structure of some jsons.

I'm trying to get the root folder where are stored the files doing this:

```python
import os
def getPath():
    return os.getcwd() + "\data\projects\\.files\schemas\"

```

But for some reason instead of getting this path:  
`C:\Program Files\Inductive Automation\Ignition\data\projects\\.files\schemas`

The os.getcwd() is returning this:

`C:\Users\Idom\Ignition\data\projects\\.files\schemas`

I checked the folder and I noticed that in the second path there is a **designerlauncher.exe** file.

I wanna ask if in newer version has changed something about the paths or If I'm doing something wrong. I'm working in Perspective but the script file is in the Scripting folder.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [May 7, 2024, 9:36am UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/2 "2024-05-07T09:36:46Z")

</div>

ive gotten the path to some json files(views) with this, in the past, so idk if it still hold for the last updates, but i guess it should

```python
	from com.inductiveautomation.ignition.gateway import IgnitionGateway
		
	context = IgnitionGateway.get()
	pathToProjectFolder = str(context.systemManager.dataDir.absoluteFile).replace('\\','/') + '/projects'	
	pathToProject = pathToProjectFolder + "/" + system.perspective.getProjectInfo().name + "/com.inductiveautomation.perspective/views/"

```

(used it for finding translation keys)

> [@Export all component text used in Ignition](https://forum.inductiveautomation.com/t/export-all-component-text-used-in-ignition/53668/4):
>
> Here is a script i used to automatically add all text values to the translate manager in perspective By checking the resource files… warning this may take a while xd import os import json from com.inductiveautomation.ignition.gateway import IgnitionGateway from com.inductiveautomation.ignition.gateway.script import GatewaySystemUtilities package = IgnitionGateway.get().getLocalizationManager().loadFullPackage() oldKeys = package.getAvailableKeys() context = IgnitionGateway.get() path…

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [May 7, 2024, 10:11am UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/3 "2024-05-07T10:11:12Z")

</div>

Sadly it doesn't, or I'm not able to make it work.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0ec45192b08d02ccdb884da9257e672f97e646a9.png)

As I have seen in the forum `IgnitionGateway` now is a private Class.

Thanks for the help anyway!

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [May 7, 2024, 10:22am UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/4 "2024-05-07T10:22:38Z")

</div>

Are you sure you are running this in the correct scope? the screen shot suggests its the script console, this will not work in the script console, but will (might) run on a button/ gateway scope

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [May 7, 2024, 12:29pm UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/5 "2024-05-07T12:29:04Z")

</div>

I need it in a script file (_code.py_).

What I did was place it in a function and call it from the scripting console. I need to be able to get the correct path to my schemas folder.  
`C:\Program Files\Inductive Automation\Ignition\data\projects\.files\schemas`

Hard-coding it will work, but I need it to work for Linux and Windows, that's why I need to be able to get to the project folder independent of the OS.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [May 7, 2024, 12:58pm UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/6 "2024-05-07T12:58:14Z")

</div>

> [@danielps1818](#):
>
> I need it in a script file (_code.py_).

i think thats fine if its the gateway that triggers this code, im not sure

> [@danielps1818](#):
>
> call it from the scripting console

try it in a button, to see if that works

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 7, 2024, 2:04pm UTC](https://forum.inductiveautomation.com/t/getting-ignition-root-folder/90004/7 "2024-05-07T14:04:05Z")

</div>

The project script library has no inherent scope. It's a _library_. What matters is where you invoke it from.  
In a Perspective context, even in the designer, your code will be running on the gateway. In the script console, your code will be running on the local machine you're running the designer on.
