djjd47130 / HoardHelper

JD Hoard Helper - A set of tools for managing hoards of files
MIT License
4 stars 1 forks source link

Mechanism to manage libraries of different types of media, and restrict scripting to ONLY those libraries #2

Closed djjd47130 closed 4 months ago

djjd47130 commented 5 months ago

Goal

Allow user to create and manage different libraries, and further restrict the scripting language to ONLY access data in these libraries.

For example, a library named "Movies" at path "D:\Media\Movies". In the script, you will not be permitted to access files via "D:\Media\Movies..." - instead, you must use "Movies...".

Requirements

djjd47130 commented 5 months ago

Loading, Managing, and Saving libraries is done. Next is to integrate it into the scripts, and change ALL paths in script to require relative paths via library names.

For example, a library named "Movies" at path "D:\Media\Movies\". In the script, you will not be permitted to access files via "D:\Media\Movies..." - instead, you must use "Movies...".

djjd47130 commented 5 months ago

HUGE PROGRESS converting the script over to use relative library paths. Just buttoning things up, and will commit soon.

djjd47130 commented 5 months ago

Things took a toll for the worse - I'm battling strange behavior where half the time it tries to use an absolute path anyway, then fails because it doesn't include the library name prefix. Then the fact that I inadvertently discovered a back door that allowed me to browse files way outside my libraries and search criteria...

djjd47130 commented 4 months ago

Finally figured out the problem - apparently TPath.Combine is very sensitive, and doesn't work as expected. For example, TPath.Combine('Media', '\Test\File.abc'); SHOULD output 'Media\Test\File.abc' but instead outputs '\Test\File.abc'.

Therefore, TPath.Combine cannot be trusted, and concatenating paths should be done manually, or otherwise by other means.