forked from yousseb/meld
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeld.applescript
More file actions
executable file
·39 lines (33 loc) · 1.63 KB
/
Copy pathmeld.applescript
File metadata and controls
executable file
·39 lines (33 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env osascript
on run argv
--set current_path to do shell script "echo $PWD"
set macos_path to POSIX path of ((path to me as text) & "::")
set contents_path to parentFolder for macos_path
set frameworks_path to contents_path & "/Frameworks"
set resources_path to contents_path & "/Resources"
set library_path to (quoted form of frameworks_path) & ":" & (quoted form of (resources_path & "/lib"))
-- return do shell script "cd " & quoted form of current_path & ";DYLD_LIBRARY_PATH=" & library_path & " " & quoted form of (macos_path & "Meld-bin") & " " & argv
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
do shell script "DYLD_LIBRARY_PATH=" & library_path & " exec " & quoted form of (macos_path & "Meld-bin") & " " & argv as text & " --"
end run
-- FUNCTIONS
-- From https://stackoverflow.com/a/30824337
to parentFolder for aPath
set aPath to posixPath for aPath
set {tids, text item delimiters, i} to {text item delimiters, "/", ((aPath ends with "/") as integer) + 1}
set {pF, text item delimiters} to {text 1 thru text item -(i + 1) of aPath, tids}
return pF
end parentFolder
-- From https://stackoverflow.com/a/30824337
to posixPath for aPath
if class of aPath is not text then set aPath to aPath as text
if aPath contains ":" then set aPath to POSIX path of aPath
repeat while aPath starts with "//"
set aPath to (characters 2 thru -1 of aPath) as text
end repeat
repeat while aPath ends with "//"
set aPath to (characters 1 thru -2 of aPath) as text
end repeat
return aPath
end posixPath