Jump to content

Relative Paths on a Mac in JS?


esmith

Recommended Posts

I am trying to use a relative path in a JavaScript rule on the Mac to pull resources on the fly. The folder containing the would-be resources are in the same location as the FP template so I am using a rule such as:

return CreateResource("_graphics/" + Field("Name") + ".pdf","graphic");

The goal is to be able to preview the graphic on a production Mac, and then upload the template to FP Server (PC). If I use an absolute path, the path will change once the template is uploaded.

 

Does FP support relative paths? If so, what am I doing wrong? If not, what is the proper way for working with templates on a Mac that will eventually be used on FP Server?

Link to comment
Share on other sites

Nevermind, after hours of trial and error, I finally determined that it would work this way:

var SearchPath = (FusionPro.isMac) ? "::_graphics:" : "_graphics\\";
return CreateResource(SearchPath + Field("Name") + ".pdf","graphic");

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...