Plugincommonpath in RW 8.1

Continuing the discussion from Changes to 8.1 php server?:

@tpbradley I’m answering here as original topic is now locked, meh… :sleepy:

In RapidCart we are currently creating a config file containing a “common files relative path” value which is [params valueForKey:@"filesfoldername"] in preview and masterstyle modes, while it is set combining [params valueForKey:@"plugincommonpath"] and [params valueForKey:@"location"] depending on the value of [params valueForKey:@"commonpathsrelative"] in export and publish modes.

I’m not sure if this is overcomplicated, and, yes, it’s possibly time for some code review, but the quickest and dirtiest fix, given the imminent release of RW 8.1, was to simply use plugincommonpath only when running on RW >= 8.1 if we don’t want to break it on previous RW versions.

We need to further look into this one, though @rob.

Hey @gibo,

I don’t think you need to change things based on RapidWeaver version, do you?

The params dictionary will contain the correct path for the version of RapidWeaver that you’re running on. You should just use whatever value it gives you.

For example, if you want the path to your plugin’s folder inside rw_common, you should use params[@"plugincommonpath"]. No matter which version of RapidWeaver your plugin is running on (from RapidWeaver 6 through to 8.1), that will always return the correct path.
The actual path provided by RapidWeaver might differ between versions (as you’ve found), but you don’t need to worry about that. You can just add files to the directory you’ve been given, and RapidWeaver will take care of the rest.

Is there anything I’m missing?



Nope, you’re definitely right. @simon

As I said, we were using our own custom methods to build the path in some cases. IIRC this happened because some previous RW versions (RW6?) didn’t handle correctly plugincommonpath when File Links Are advanced project option was set to something different than default Relative to Page.

I’ve quickly tested simply passing plugincommonpath and everything seems to work as expected in RW versions we currently support (7 & 8).

Can you confirm release date for stable RW 8.1? @dan

Thanks for your help.

1 Like

Excellent! That’s great news.

It’s always nice when you get to delete code, right? :smile:

1 Like