Scripting: adjust inconsistent path parsing

Features wanted...
admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting: adjust inconsistent path parsing

Post by admin »

SammaySarkar wrote: 29 Jan 2019 11:10
  • savethumb() does not support relative paths. Plans to support?
  • columnlayout(), loadlayout(), paperfolder() partially accepts relative paths in that they can prepend <xydata>\(columns|layouts|paper), but breaks with .\ and ..\. Do you think these should also correctly support dotted relative paths, being relative to their function-specific base locations?
    so for example, columnlayout("..\..\xydata.bak\columns\defaultcolumns.txt") will work, (load columns from a backup profile directory by pathfinding to parent folders of <xydata>\columns)
savethumb(): Yes, coming...

columnlayout(), loadlayout(), paperfolder() : that were 3 bugs :bug: :bug: :bug: . Fix comes.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Scripting: adjust inconsistent path parsing

Post by bdeshi »

admin wrote: 29 Jan 2019 19:13
SammaySarkar wrote: 29 Jan 2019 11:10 catalogload also does not support dotted relative paths. This is more confusing because for example, catalogload("..\..\catalog.dat") fails, but the error message has the correct path!

Code: Select all

Not Found
-----------------------------------
Could not find: 

D:\tools\XYplorer\catalog.dat      (note: this file exists in this exact path.)
so the error supports relative paths better than the command itself! :ghost:
1) Cannot confirm.

2) The help says: "Can be relative to the application data folder." So I cannot change anything here.
Got it: "Can be relative to the application data <xycatalogs> folder."

Code: Select all

-- folders -------------------------
parent\xydata\catalogs\catalog.dat
parent\xydata\xydata-catalog.dat
parent\parent-catalog.dat
-- code ----------------------------
catalogload "catalog.dat"; // <xycatalogs>\catalog.dat == parent\xydata\catalogs\catalog.dat
catalogload ".\catalog.dat"; // <xycatalogs>\catalog.dat
catalogload "..\xydata-catalog.dat"; // <xycatalogs>\..\xydata-catalog.dat
catalogload "..\..\parent-catalog.dat"; // <xycatalogs>\..\..\parent-catalog.dat
This is okay; just change the text in the user manual.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Scripting: adjust inconsistent path parsing

Post by admin »

Ah! :oops: Thanks!

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Scripting: adjust inconsistent path parsing

Post by WirlyWirly »

I'm currently trying to use a relative path in a PaperFolder .txt file, but haven't been able to get it to work. Have relative paths not been enabled for PaperFolders?

My paths are as follows...

Code: Select all

# <xypath>
A:\PortableApps\PortableApps\xyPlorer\xyplorer.exe

# Target file
A:\PortableApps\PortableApps\7-ZipPortable\7-ZipPortable.exe

# Line in PaperFolder.txt relative to <xypath>
<xypath>..\..\7-ZipPortable\7-ZipPortable.exe
I use this same relative path in a .xys file and it works great, so I'm assuming if PaperFolders supported relative paths then the syntax would be the same.

jupe
Posts: 2757
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Scripting: adjust inconsistent path parsing

Post by jupe »

Below quote from the help file, you should check it out:
Help File, in fact the first sentence under Paper Folders heading wrote:Paper Folders are simple text files that contain the full paths to items, one per line.

Post Reply