# system.pathForFile returning nil

**URL:** <https://forums.solar2d.com/t/system-pathforfile-returning-nil/330387>\
**Category:** CoronaCards for WP8\
**Created:** [December 2, 2014, 4:47pm UTC](https://forums.solar2d.com/t/system-pathforfile-returning-nil/330387 "2014-12-02T16:47:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Appoet](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/7ea924/32.png) [@Appoet](https://forums.solar2d.com/u/Appoet)\
**Post date:** [December 2, 2014, 4:47pm UTC](https://forums.solar2d.com/t/system-pathforfile-returning-nil/330387/1 "2014-12-02T16:47:17Z")

</div>

I’m porting another app and it keeps crashing because&nbsp;system.pathForFile(fileName,system.ResourceDirectory) and&nbsp;local file = io.open(path, “r”) returns nil.

And:&nbsp;bad argument #1 to ‘open’ (string expected, got nil)

&nbsp;

What I am missing? Thanks.

&nbsp;

Edit:

&nbsp;

It seems to be windows doesn’t want to open .json files.&nbsp;

&nbsp;

Is this a known issue? Is there a work around?

---

<div class="post-metadata">

**Author:** ![Joshua\_Quick](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/c37758/32.png) [@Joshua\_Quick](https://forums.solar2d.com/u/Joshua_Quick)\
**Post date:** [December 2, 2014, 8:00pm UTC](https://forums.solar2d.com/t/system-pathforfile-returning-nil/330387/2 "2014-12-02T20:00:41Z")

</div>

Odds are your JSON files’ “Build Action” are not flagged as “Content”. &nbsp;This tells Visual Studio to include your asset files within the compiled app bundle. &nbsp;Please see step 5 and 6 from the link below on how to do this.

&nbsp; &nbsp;[http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files](http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files)

For you info, we warn about this in the above link in the “Notes” box, bullet 3. &nbsp;Visual Studio will only automatically flag certain file extension as “Content”. &nbsp;For file extensions Visual Studio does not recognize, it will do nothing with them. &nbsp;This is definitely true of \*.json, \*.ttf, and \*.otf. &nbsp;You might want to double check that all of your files under “Assets\Corona” are flagged as “Content” just in case.

---

<div class="post-metadata">

**Author:** ![Joshua\_Quick](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/c37758/32.png) [@Joshua\_Quick](https://forums.solar2d.com/u/Joshua_Quick)\
**Post date:** [December 2, 2014, 8:00pm UTC](https://forums.solar2d.com/t/system-pathforfile-returning-nil/330387/3 "2014-12-02T20:00:41Z")

</div>

Odds are your JSON files’ “Build Action” are not flagged as “Content”. &nbsp;This tells Visual Studio to include your asset files within the compiled app bundle. &nbsp;Please see step 5 and 6 from the link below on how to do this.

&nbsp; &nbsp;[http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files](http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files)

For you info, we warn about this in the above link in the “Notes” box, bullet 3. &nbsp;Visual Studio will only automatically flag certain file extension as “Content”. &nbsp;For file extensions Visual Studio does not recognize, it will do nothing with them. &nbsp;This is definitely true of \*.json, \*.ttf, and \*.otf. &nbsp;You might want to double check that all of your files under “Assets\Corona” are flagged as “Content” just in case.
