WebMerge Path Inconsistencies

Initializing with this:

> ;set binary folder paths for the html site and templates
> LetGlobal gvHTMLPath = folder("/Library/WebServer/Documents/RnD/")
> LetGlobal gvTemplatePath = folder("/Library/WebServer/Documents/RnD/templates/")
> 
> ;set path strings for same
> LetGlobal gvHTMLPathStr = "/Library/WebServer/Documents/RnD/"
> LetGlobal gvTemplatePathStr = "/Library/WebServer/Documents/RnD/templates/"
> 
> LetGlobal cgiHTML = "Initialized" +"<br /><br />"+
> gvTemplatePathStr +"<br /><br />"+
> replace(listfiles(gvTemplatePathStr,""),¶,"<br />") +"<br /><br />"+
> pathstr(gvTemplatePath) +"<br /><br />"+
> replace(listfiles(pathstr(gvTemplatePath),""),¶,"<br />")

returns this in a browser:

> Initialized
> 
> /Library/WebServer/Documents/RnD/templates/
> 
> PanXTrials.html
> robots.txt
> 
> Prometheus:Library:WebServer:Documents:RnD:templates:
> 
> PanXTrials.html
> robots.txt

Notice that the binary path has been changed to using colons and the computer name: Prometheus

Now if I hit the server to have it merge a page, using the binary path:

> webmerge pathstr(gvTemplatePath),"PanXTrials.html",cgiHTML

I get this error with the computer name prepended twice:

> WEBMERGE Error: Template "Prometheus:Prometheus:Library:WebServer:Documents:RnD:templates:PanXTrials.html" does not exist!

I do get a successful merge using the non-binary path, but this is a notable inconsistency.

Dragging the file to Panorama to check the path format yields:

> /Library/WebServer/Documents/RnD/templates/PanXTrials.html

Yes, that is what the pathstr( function does. It’s now called the folderpath( function (but pathstr( also works).

Ok, looks like the problem is that the WebMerge statement doesn’t currently accept HFS paths, only UNIX paths.

In this case since you already have a UNIX path, you can immediately get your code working by simply using that.

webmerge gvTemplatePath,"PanXTrials.html",cgiHTML

Note: The preferred method to format code here in the forum is to indent it by 4 spaces (rather than prefixing it with > . That way the code can be copied straight from the forum, ready to use. Denali has convenient Source>Copy Indented Code command that makes this easy.

Notice that the binary path
using the binary path

I’m not sure why you say “using the binary path”, when you’ve converted it to text. But more importantly, there really is no such thing as a “binary path” in Panorama X. This was a structure used by Classic Mac OS, and modern macOS doesn’t have that structure. In Panorama X, the “folder id” is simply the UNIX path. This is all discussed in depth in the Files and Folders help page, and was also covered in one of the intensive training sessions in 2015.

For new code, best practice is simply to use UNIX paths everywhere and not bother with the folder( or folderpath( functions (or pathstr( ).