# studio.system.getFile API sometimes cannot load from relative path

**URL:** <https://qa.fmod.com/t/studio-system-getfile-api-sometimes-cannot-load-from-relative-path/21865>\
**Category:** FMOD Studio\
**Tags:** studio-scripting-api\
**Created:** [July 11, 2024, 7:14am UTC](https://qa.fmod.com/t/studio-system-getfile-api-sometimes-cannot-load-from-relative-path/21865 "2024-07-11T07:14:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor647](https://avatars.discourse-cdn.com/v4/letter/v/ee7513/32.png) [@victor647](https://qa.fmod.com/u/victor647)\
**Post date:** [July 11, 2024, 7:14am UTC](https://qa.fmod.com/t/studio-system-getfile-api-sometimes-cannot-load-from-relative-path/21865/1 "2024-07-11T07:14:28Z")

</div>

I have a script that loads a json file from a custom defined folder within my FMOD project directory. I am writing my script as

```auto
var data = studio.system.getFile("New Folder/MyText.txt")

```

Sometimes the script runs without any problems, but sometimes it will throw an error of

```auto
QIODevice::read (QFile, "New Folder/MyText.txt"): device not open 

```

So how does this function work? Is there a more stable way of using relative paths in Studio Scripting API?

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [July 16, 2024, 6:44am UTC](https://qa.fmod.com/t/studio-system-getfile-api-sometimes-cannot-load-from-relative-path/21865/2 "2024-07-16T06:44:44Z")

</div>

The working directory of `studio.system.getFile()` should be the install directory of FMOD studio, and not of your project directory. If you wish to access a file in your project directory, the easiest way would be use `studio.project.filePath`, which is the location of the project `.fspro`, and then do some string manipulation to get the project directory:

```js
var projectDir = studio.project.filePath;
projectDir = projectDir.substr(0, projectDir.lastIndexOf("/") + 1);

```

That said, unfortunately I haven’t been able to reproduce the error you’re observing. Can I get your to post the full script, or a stripped-down version where you can still reproduce the error, here for me to take a closer look at? Also, what version of FMOD Studio are you using?
