Jump to content

dropbox-synced settings on two machines - dynamic relative file paths?


Recommended Posts

Hi there!

I have a bunch of simple shortcuts to open specific Dropbox folders, which I'd like to use across both my macbook and macpro. I have my settings synced, which works great for most of my matching folders (i.e. ~/Library), however the Dropbox location on the macpro is in an internal drive (/Volumes/DB HD/Dropbox) so it doesn't match the path on my macbook (~/Dropbox).

 

Is there a way to have conditional statement to trigger 1 of 2 provided paths, according to which machine is calling the workflow?

 

Thanks!!

Link to comment
On 6/4/2021 at 5:55 PM, deanishe said:

Do you sync your Alfred preferences via Dropbox?

Yes that's right I do.

 

On 6/4/2021 at 7:10 PM, dfay said:

yes. see

 

 

 

Thank you! This looks about right

Link to comment
Posted (edited)
8 hours ago, dterranova said:

Yes that's right I do.

 

When Alfred runs a workflow, the workflow's directory is the current working directory. So you can access any path in Dropbox using a relative path from your Alfred preferences instead of an absolute one. Say your Dropbox looks like this:

 

Dropbox/
    Alfred.alfredpreferences/
        workflows/
            user.workflow.BLAH-BLAH-BLAH/  <--- working directory
                you-are-here.py
    Documents/
    Photos/

 

When any workflow is run, you can access Dropbox/Documents at ../../../Documents

 

That might not work in all cases, but when it's possible, it's the simplest way, imo.

Edited by deanishe
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...