Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Error in Update-TacO.ps1 creating shortcut #11

Open
solacelost opened this issue Aug 14, 2020 · 0 comments
Open

Error in Update-TacO.ps1 creating shortcut #11

solacelost opened this issue Aug 14, 2020 · 0 comments

Comments

@solacelost
Copy link
Owner

Report came in via Discord:

Unable to save shortcut "C:\Users\[REDACTED]\Desktop\GW2TacO.lnk".
At C:\Users\[REDACTED]\AppData\Roaming\Update-ArcDPS\Update-TacO.ps1:295 char:5
+     $Shortcut.Save()
+     ~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundExcep
   tion
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException

Exception calling "ReadAllBytes" with "1" argument(s): "Could not find a part
of the path 'C:\Users\[REDACTED]\Desktop\GW2TacO.lnk'."
At C:\Users\[REDACTED]\AppData\Roaming\Update-ArcDPS\Update-TacO.ps1:297 char:5
+     $bytes = [System.IO.File]::ReadAllBytes($ShortcutFile)
+     ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DirectoryNotFoundException

Cannot index into a null array.
At C:\Users\[REDACTED]\AppData\Roaming\Update-ArcDPS\Update-TacO.ps1:298 char:5
+     $bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 ( ...
+     ~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Exception calling "WriteAllBytes" with "2" argument(s): "Value cannot be null.
Parameter name: bytes"
At C:\Users\[REDACTED]\AppData\Roaming\Update-ArcDPS\Update-TacO.ps1:299 char:5
+     [System.IO.File]::WriteAllBytes($ShortcutFile, $bytes)
+     ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Sounds like:

  • Desktop directory was pathed wrong
  • Desktop folder didn't exist, unable to save shortcut
  • Once unable to save shortcut, couldn't read bytes
  • Remaining errors were attempts to index into bytes for file that couldn't be read

So, instead of $ShortcutFile = "$env:HOMEPATH\Desktop\GW2TacO.lnk" I should move to reading [System.Environment]::GetFolderPath("Desktop") instead, as the Desktop folder may be moved via Library functionality and this should track it down.

solacelost added a commit that referenced this issue Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant