User Tools

Site Tools


en:examples:resource_management:locate_file

Find the Path of a File

Finding the path of a file bundled with Orx's config files and image can be non-trivial without Orx's utilities in a platform independent manner.

Code

const orxSTRING zLocation = orxResource_Locate("Magic", "Awesome.mag");
// zLocation looks like "file:/path/to/Awesome.mag" if found
if(zLocation)
{
  const orxSTRING zPath = orxString_SearchChar(zLocation, orxRESOURCE_KC_LOCATION_SEPARATOR) + 1;
  // zPath looks like /path/to/Awesome.mag
}

Config

[Resource]
Magic = @.Config ; Define a custom resource group "Magic"

en/examples/resource_management/locate_file.txt · Last modified: 2018/02/14 00:47 (5 years ago) (external edit)