dev.ChangingFilePathFormat - tixl3d/tixl GitHub Wiki

Changing the format of file assets and resources paths

Preface

Over the years TiXL file resource management gather a lot of features likes file hooks, auto reloaded, cross project shared resources, etc. Sadly this lead to an overly complex and system that feels arbitrary and confusing. With 4.1 we try to resolve and unify most of these issues.

Problems before v4.1

In v4.0 all these are valid and used file paths:

Resources\lib\img\Default-cs.hlsl
/Examples/user/cynic/particles/Default-ps.hlsl
/t3/images/frog2.jpg
/Lib/images/numbers-4x6px.png
pointexport.json
C:\Users\pixtur\Downloads\a crow and a rainstorm.mp4
https://cataas.com/cat

We can see tons of issues with this approach:

  • Mixing backslashes will make these paths unusable for Linux and MacOS.
  • Mixing URLs with filepath resources just feels wrong
  • t3 is a legacy prefix from Tooll3 that will confuse new TiXL users.
  • There is no clear distinction between build-in and user resources.
  • There are many options to address the same asset which makes caching, comparing and rendering thumbnails more complicated.
  • Dropping the project prefix will prevent copy and pasting between projects and makes it very hard to automatically fix filenames.
  • It can include the "Resources" folder prefix.

With v4.1 we will fix all this.

Changes with v4.1

We will introduce a new consistent format for resource path for relative file paths that looks like this:

ProjectName : path/in/Asset/filename.ext

When starting TiXL v4.1 we will automatically convert all paths into the following:

before with V4.1
Resources\lib\img\Default-cs.hlsl Lib:img/Default-cs.hlsl
/Lib/images/numbers-4x6px.png Lib:images/numbers-4x6px.png
/t3/images/frog2.jpg Lib:images/frog2.jpg
/Examples/user/cynic/particles/Default-ps.hlsl Examples:user/cynic/particles.Default-ps.hlsl
pointexport.json Playground:pointexport.json
C:\Users\pixtur\Downloads\a crow and a rainstorm.mp4 not changed
https://cataas.com/cat not changed

Automatic fixes:

  • All backslashes \ will automatically converted to forward slashes /.
  • All relatives paths will have a package prefix followed by a :.
  • TiXL will also automatically rename the magic Resources/ folders into Assets/.