Windows Phone Directories.. Deployment Issue system.ResourceDirectory ?

I have a file in my root folder called menuItems.json.

When I deploy to my windows phone I cannot access the file, I get an error about the file not found.

If I test in the ( corona simulator )  I can access it just fine.

I would copy it to the phones system.DocumentsDirectory folder but I cannot open / read it in order to copy it there.

how can I use Corona to open my file?

Like I said he code runs on in the normal Corona Simulator so it something about the device.

this is how I am trying to get the file path for the file

local srcPath = system.pathForFile( “menuItems.json”, system.ResourceDirectory)

print(srcPath )  - prints a nil

Yes the file is in the same location as the main.lua - specified in Corona Docs.

  • and just think I was showing off my app on a windows phone - AT MICROSOFT - help please

Thanks in advance.

Larry

Did you remember to set the .json file’s Build Action to “Content” in the  in the Advanced sectin of it’s properties?

Ht089Mk.png

And does the file name match case wise?

@Alex@Panc  - Actually I tried to set it to content before I blogged in the forum :slight_smile: Good idea most people dont know about that :slight_smile:

But when I clicked on the JSON file it would not let me change the build avtion in the properties. I right clicked on the file and selected properties ( as I always do in VS 2013 ) but it was not available to be changed. unless im missing something…

@Rob file name matches exactly - I even did a file rename on windows explorer and copied the name to the app just to make sure my eyes were not crossed and stuff.

@Rob should I be able to se the property of Build Action to Content ? If so then I can dig into my VS 2013  / reboot etc…

Oh by the way the first part of the app - looks so sweet on my windows phone :slight_smile:

Any other thoughts?

I think Alex is right.  Odds are your JSON files are not being bundled into the WP8 *.xap file.  By default, Visual Studio does not automatically flag JSON files as “Content”.

To prove it, I would recommend that you “unzip” your *.xap file and verify that all of the expected files got included.  You can do this by…

  1. In Windows Explorer, navigate to your project’s “Bin\<Debug|Release>\ARM” directory.

  2. Rename your compiled *.xap file’s extension to *.zip.

  3. Double click on the zip file.

Inside the *.xap file, notice that it contains and “Assets\Corona” folder just like how it is set up in Visual Studio’s “Solution” panel.  From here you can verify that all of the files in your project are actually getting included.

If they are, then it’s possible that you might be running into an “incremental build” issue, where your newly built apps are not actually getting deployed to the device.  It’s rare, but I’ve seen it happen to me a couple times in the past (might be a Visual Studio bug).  To solve this issue:

1) Delete your app from the WP8 device.

  1. Do a “clean” build by clicking Visual Studio’s “Build\Rebuild” menu item.

  2. Now, click the [>] button to deploy and debug your app on the WP8 device.

Thanks for all the input, I’ll give this all a try tonight.

Larry

Issue Solved!

thanks for all of the help.

Alex@Panc actually everybody here was correct.  For some reason VS 2013 or something had my file locked and i could not set the property to content.

finally rebooted and when VS 2013 started the first thing i did was set the Build Action property  to “Content”. then the file was included in the package and the windows simulator and windows phone 8.1 device found to just fine.

thanks

Larry

Glad to hear that it’s sorted!

Did you remember to set the .json file’s Build Action to “Content” in the  in the Advanced sectin of it’s properties?

Ht089Mk.png

And does the file name match case wise?

@Alex@Panc  - Actually I tried to set it to content before I blogged in the forum :slight_smile: Good idea most people dont know about that :slight_smile:

But when I clicked on the JSON file it would not let me change the build avtion in the properties. I right clicked on the file and selected properties ( as I always do in VS 2013 ) but it was not available to be changed. unless im missing something…

@Rob file name matches exactly - I even did a file rename on windows explorer and copied the name to the app just to make sure my eyes were not crossed and stuff.

@Rob should I be able to se the property of Build Action to Content ? If so then I can dig into my VS 2013  / reboot etc…

Oh by the way the first part of the app - looks so sweet on my windows phone :slight_smile:

Any other thoughts?

I think Alex is right.  Odds are your JSON files are not being bundled into the WP8 *.xap file.  By default, Visual Studio does not automatically flag JSON files as “Content”.

To prove it, I would recommend that you “unzip” your *.xap file and verify that all of the expected files got included.  You can do this by…

  1. In Windows Explorer, navigate to your project’s “Bin\<Debug|Release>\ARM” directory.

  2. Rename your compiled *.xap file’s extension to *.zip.

  3. Double click on the zip file.

Inside the *.xap file, notice that it contains and “Assets\Corona” folder just like how it is set up in Visual Studio’s “Solution” panel.  From here you can verify that all of the files in your project are actually getting included.

If they are, then it’s possible that you might be running into an “incremental build” issue, where your newly built apps are not actually getting deployed to the device.  It’s rare, but I’ve seen it happen to me a couple times in the past (might be a Visual Studio bug).  To solve this issue:

1) Delete your app from the WP8 device.

  1. Do a “clean” build by clicking Visual Studio’s “Build\Rebuild” menu item.

  2. Now, click the [>] button to deploy and debug your app on the WP8 device.

Thanks for all the input, I’ll give this all a try tonight.

Larry

Issue Solved!

thanks for all of the help.

Alex@Panc actually everybody here was correct.  For some reason VS 2013 or something had my file locked and i could not set the property to content.

finally rebooted and when VS 2013 started the first thing i did was set the Build Action property  to “Content”. then the file was included in the package and the windows simulator and windows phone 8.1 device found to just fine.

thanks

Larry

Glad to hear that it’s sorted!