|
5 | 5 | ' 2. Standalone, by hand, with no arguments -- looks up the current InteractiveGMT install via |
6 | 6 | ' Julia (Base.find_package) and reports success/failure with a MsgBox. |
7 | 7 | ' |
8 | | -' Two install shapes, two different strategies -- detected by pkgRoot's PATH STRUCTURE, not by |
9 | | -' whether Manifest.toml happens to exist there (tried that first; wrong -- Manifest.toml only |
10 | | -' exists in a dev checkout that's been SEPARATELY instantiated as its own project, e.g. this |
11 | | -' actual dev machine where it's been actively worked on directly. A freshly `] dev`ed checkout on |
12 | | -' any other machine has NO Manifest.toml of its own at all -- the resolved dependency graph lives |
13 | | -' in the DEFAULT environment instead -- so that check misdetected it as add-style and copied |
14 | | -' files to Desktop again). `] dev` always installs to <depot>\dev\<Name>\, `] add` to |
15 | | -' <depot>\packages\<Name>\<hash>\ -- checking the immediate parent folder's name ("dev" or not) |
16 | | -' is reliable regardless of instantiation state. |
17 | | -' |
18 | | -' STABLE (`] dev`-installed): pkgRoot is a FIXED directory that never moves again. Point the |
19 | | -' shortcut DIRECTLY at pkgRoot's own iview_app.vbs/igmt.ico -- no copying, no Desktop clutter, |
20 | | -' nothing that can go stale or hit a read-only-copy bug. This is what a `dev` install actually |
21 | | -' wants: ONE icon, pointing straight at the real files. |
22 | | -' |
23 | | -' UNSTABLE (`] add`-installed): pkgRoot is a content-hashed folder that gets a NEW hash on |
24 | | -' every Pkg.update, so a direct-pointing shortcut would go stale. Copy iview_app.vbs |
25 | | -' (re-resolves the live install at every launch, so ITS content never goes stale) and igmt.ico |
26 | | -' to the Desktop ONCE, point the shortcut at those local copies instead. A .lnk's ICON path is |
27 | | -' read once when opened -- unlike iview_app.vbs's own launch target, it can't be resolved |
28 | | -' dynamically, so it needs a permanent home the Pkg-hash-changing tree can't provide. |
| 8 | +' EXACTLY ONE icon, always. It points STRAIGHT at pkgRoot's own iview_app.vbs and igmt.ico -- we |
| 9 | +' NEVER copy those files to the Desktop and NEVER point the shortcut at a Desktop copy. (An earlier |
| 10 | +' version had a second "copy to Desktop for `] add` installs" branch; it littered the Desktop with |
| 11 | +' iview_app.vbs + igmt.ico and pointed the .lnk at desktop\iview_app.vbs -- forbidden. Removed.) |
| 12 | +' iview_app.vbs is already self-locating, so even for a hash-changing `] add` install the direct |
| 13 | +' target stays valid enough; the icon path is the only thing that could go stale, and that is an |
| 14 | +' acceptable trade against ever cluttering the Desktop. |
29 | 15 | Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") |
30 | 16 | Dim sh : Set sh = CreateObject("WScript.Shell") |
31 | 17 |
|
@@ -61,39 +47,24 @@ End If |
61 | 47 | Dim desktop : desktop = sh.ExpandEnvironmentStrings("%USERPROFILE%") & "\Desktop" |
62 | 48 | If Not fso.FolderExists(desktop) Then fso.CreateFolder desktop |
63 | 49 |
|
64 | | -Sub ForceCopy(src, dest) |
65 | | - ' Pkg marks package source files READ-ONLY on Windows -- and FileSystemObject.CopyFile |
66 | | - ' PRESERVES that attribute onto the destination, so a plain overwrite=True copy silently |
67 | | - ' fails with "Permission denied" once the destination already exists. DeleteFile's |
68 | | - ' force=True DOES bypass read-only, so delete first, then copy fresh, every time. |
69 | | - If fso.FileExists(dest) Then fso.DeleteFile dest, True |
70 | | - fso.CopyFile src, dest, True |
71 | | -End Sub |
72 | | - |
73 | | -Dim targetVbs, targetIco |
74 | | -Dim isDevInstall : isDevInstall = (LCase(fso.GetFileName(fso.GetParentFolderName(pkgRoot))) = "dev") |
| 50 | +' EXACTLY ONE icon, and it points STRAIGHT at the real source files in pkgRoot -- never a copy on |
| 51 | +' the Desktop, never a shortcut whose target is desktop\iview_app.vbs. (An earlier version copied |
| 52 | +' the .vbs+.ico to the Desktop for `add` installs and pointed the .lnk at those copies; that is |
| 53 | +' forbidden -- it littered the Desktop with extra files and a wrong-target shortcut.) So: delete |
| 54 | +' any stray copies a previous run may have dropped, then create the single .lnk -> source. |
| 55 | +If fso.FileExists(desktop & "\iview_app.vbs") Then fso.DeleteFile desktop & "\iview_app.vbs", True |
| 56 | +If fso.FileExists(desktop & "\igmt.ico") Then fso.DeleteFile desktop & "\igmt.ico", True |
75 | 57 |
|
76 | | -If isDevInstall Then |
77 | | - ' STABLE (dev) install -- point straight at the real files, no copies. Also clean up any |
78 | | - ' leftover Desktop copies from an earlier `add`-style run (or an earlier version of this |
79 | | - ' script) so there's exactly one set of files, not stale duplicates lying around confusing |
80 | | - ' things. |
81 | | - If fso.FileExists(desktop & "\iview_app.vbs") Then fso.DeleteFile desktop & "\iview_app.vbs", True |
82 | | - If fso.FileExists(desktop & "\igmt.ico") Then fso.DeleteFile desktop & "\igmt.ico", True |
83 | | - targetVbs = pkgRoot & "\iview_app.vbs" |
84 | | - targetIco = pkgRoot & "\igmt.ico" |
85 | | -Else |
86 | | - ' UNSTABLE (add) install -- copy to a permanent home first. |
87 | | - ForceCopy pkgRoot & "\iview_app.vbs", desktop & "\iview_app.vbs" |
88 | | - ForceCopy pkgRoot & "\igmt.ico", desktop & "\igmt.ico" |
89 | | - targetVbs = desktop & "\iview_app.vbs" |
90 | | - targetIco = desktop & "\igmt.ico" |
91 | | -End If |
| 58 | +' Normalize any forward slashes -- callers sometimes pass a "/"-separated pkgRoot, and VBScript's |
| 59 | +' GetParentFolderName/GetFileName only ever split on "\". A "/"-path would otherwise build broken |
| 60 | +' targets like ".../InteractiveGMT/iview_app.vbs" that the rest of this script mishandles. |
| 61 | +pkgRoot = Replace(pkgRoot, "/", "\") |
| 62 | +If Right(pkgRoot, 1) = "\" Then pkgRoot = Left(pkgRoot, Len(pkgRoot) - 1) |
92 | 63 |
|
93 | 64 | Dim link : Set link = sh.CreateShortcut(desktop & "\iGMT.lnk") |
94 | | -link.TargetPath = targetVbs |
95 | | -link.IconLocation = targetIco |
96 | | -link.WindowStyle = 7 |
| 65 | +link.TargetPath = pkgRoot & "\iview_app.vbs" |
| 66 | +link.IconLocation = pkgRoot & "\igmt.ico" |
| 67 | +link.WindowStyle = 7 |
97 | 68 | link.Save |
98 | 69 |
|
99 | 70 | If Not calledFromBuild Then |
|
0 commit comments