Log In  

Hi Zep! :)

I'm not sure if this is by design, but it seems printh() resolves paths differently than cstore(), reload(), etc; where printh() does path resolution relative to root_path, while the other funcs resolve paths relative to the running cart.

For example, given the directory structure:

project_dir/
|_dist/
  |_foo.p8
  |_log.p8l
|_utils/
  |_bar.p8

and launching with:

project_dir $ pico8 -root_path ./ ./utils/bar.p8

project_dir/utils/bar.p8:

cstore(0, 0, 0x4300, "./dist/foo.p8") --doesn't write to foo.p8
cstore(0, 0, 0x4300, "../dist/foo.p8") --writes to foo.p8

printh("hello world!", "./dist/log") --writes to log.p8l
printh("hello world!", "../dist/log") --bad log error

I'm not sure which way I think all the funcs should behave, but I'm inclined to say printh() should resolve paths relative to the running cart like the other funcs, because it would probably be less surprises for the user that way.

Anyway, thx for your time!

P#132997 2023-08-13 03:56 ( Edited 2023-08-13 03:56)


[Please log in to post a comment]