mellow Posted May 5, 2014 Posted May 5, 2014 There was a post from a while back that worked for me until a few months ago. We had a new shared drive installed and the old Alfred workflow doesn't work anymore. This was the old code: ---- path = "{query}" unc = "" if (path.start_with?('smb:')) # smb://NetworkDrive.corp.YYYY.com/Files/Folder/Folder parts = path.split('//') # ["smb:", "NetworkDrive.corp.YYYY.com/Files/Folder/Folder"] path_parts = parts[1].split('/') # ["NetworkDrive.corp.YYYY.com", "Files", "Folder", "Folder"] server_parts = path_parts[0].split('.') # ["NetworkDrive", "corp", "YYYY", "com"] unc = "\\\\#{server_parts[0]}\\#{path_parts[1..-1].join('\\')}" else # afp://NetworkDrive/Folder/Folder/ parts = path.split('//') # ["afp:", "NetworkDrive/Folder/Folder"] path_parts = parts[1].split('/') # ["NetworkDrive", "Files", "Folder", "Folder"] unc = "\\\\#{path_parts.join('\\')}" end puts unc ---- The above old code gives something like this:\\10\Department\.... What I now need is something that turns an OS X smb file path into the following: file:////tnx3k/Department/....Any help would be greatly appreciated!
deanishe Posted May 11, 2014 Posted May 11, 2014 It's not exactly clear what you want (you've given us some output, but not the corresponding input), but you can probably throw most of the code away and just replace "smb:" / "afp:" with "file://".
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now