Jump to content
  • Advertisement
Sign in to follow this  
DarkRonin

File access in UWP?

This topic is 618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

 

I am extremely close to porting my game framework over to UWP (from Win32). Everything is compiling and working well, but I have come across a minor hurdle.

 

I have a function that loads model data which gets stored away for DirectX to use later on. But for some reason, I can't get the application to find the file (even if I hard code the path), yet the original Win32 based project sees and loads the files fine.

 

The following function loads the model file. 

 

int obj_sun = Game.objectCreate("E:\\media\\sun.dat");

 

// The section of code that loads the file
std::ifstream fs;
fs.open(filename, std::fstream::in | std::fstream::binary);
 
if (!fs.is_open())
{
_systemError("File not found");
return 0;
}
 
fs.seekg(0, std::ios::end);
int nSize = (int)fs.tellg();
char* memblock = new char[nSize];
fs.seekg(0, std::ios::beg);
fs.read(memblock, nSize);
fs.close();

Share this post


Link to post
Share on other sites
Advertisement

Yeah, I thought it would be a sandbox thing which made sense. Was actually looking at the same link too, but didn't give the actual answer on it.

 

Just worked it out right this minute. 

 

Right Click on Assets -> Add Existing Item -> Select the file

Right Click on the new 'Asset' -> Properties

  • Excluded from build - No
  • Content - Yes
  • Item Type - Does not participate in build
Edited by DarkRonin

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!