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!