Skip to content

Commit 78dff24

Browse files
Update README.md
1 parent fc4fb12 commit 78dff24

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Key | Type | Allowed | Default
146146
`outputPath` | String | Any valid path to a folder | `'%USERPROFILE%\\Desktop'` | Path where the shortcut will be placed.
147147
`name` | String | Any file system safe string | Uses name from filePath | The name of the shortcut file.
148148
`comment` | String | Any string | Not used if not supplied | Metadata file "comment" property. Description of what the shortcut would open.
149-
`icon` | String | Valid path to file (ICO, EXE, or DLL) | Uses OS default icon | The image shown on the shortcut icon. You can also pass in an index if multiple icons, like `'C:\\file.exe,0'`
149+
`icon` | String | Valid path to file (ICO, EXE, or DLL) | Uses OS default icon | The image shown on the shortcut icon. You can also pass in an index if file contains multiple icons, like `'C:\\file.exe,0'`
150150
`arguments` | String | Any string | None | Additional arguments passed in to the end of your target `filePath`
151151
`windowMode` | String | `'normal'`, `'maximized'`, `'minimized'` | `'normal'` | How the window should be displayed by default
152152
`hotkey` | String | Any string | None | A global hotkey to associate to opening this shortcut, like `'CTRL+ALT+F'`
@@ -172,7 +172,7 @@ Key | Type | Allowed | Default
172172

173173
OSX will automatically inherit the icon of the target you point to. It doesn't care if you point to a folder, file, or application.
174174

175-
**NOTE:** If `overwrite` is set to `false` and a matching file already exists, a `console.error` will occur to inform you of this, however `create-desktop-shortcuts` will still report successful. This `console.error` can be hidden by setting `verbose` to `false`, or using a `customLogger` to intercept it.
175+
**NOTE:** If `overwrite` is set to `false` and a matching file already exists, a `console.error` will occur to inform you of this, however `create-desktop-shortcuts` will still report successful (return `true`). This `console.error` can be hidden by setting `verbose` to `false`, or using a `customLogger` to [intercept it](https://github.com/nwutils/create-desktop-shortcuts/blob/main/src/library.js#L252).
176176

177177
Key | Type | Allowed | Default | Description
178178
:-- | :-- | :-- | :-- | :--
@@ -182,6 +182,15 @@ Key | Type | Allowed | Default
182182
`overwrite` | Boolean | `true`, `false` | false | If true, will replace any existing file in the `outputPath` with matching `name`. See above note for more details.
183183

184184

185+
### Special paths
186+
187+
The `filePath` for all OS's can be set to an executable name directly if it is available in the user's PATH. For example, if you set it to `'node'` or `'python'` or `'cmd'` and the user can access those from PATH variables, it will work automatically. But the file must exist and must be an actual executable, otherwise you should hard code the value.
188+
189+
The `filePath` and `outputPath` can use environment variables on Windows, like `'%appData%'`. See the "Add to start menu" section below for more examples.
190+
191+
The `filePath` and `outputPath` can start with `~` or `/` on Linux or OSX and the paths will be resolved automatically.
192+
193+
185194
### Add to start menu
186195

187196
Here are the documented paths you can use for the `outputPath` to create a shortcut in the start menu.
@@ -258,5 +267,5 @@ Parts of the `windows.vbs` were copied/modified based on:
258267
1. **Windows:** If WScript does not like what is passed to it, it displays a Windows Dialog with an error on the line that failed. I have no idea how to turn that off, so I've just added in tons of validation checks to prevent anything from being passed in to it that could cause this. But may still occur if you pass in junk to it that gets by the validation checks.
259268
1. **Linux:** No real recourse if the script does not have permission to run `chmod` on Linux. You would just need to run it again with sudo or something. If you have ideas, create an issue or PR.
260269
1. **OSX:** I know of no way to set a custom icon image on OSX. It will just always use the same icon the executable had (or file type if linking to an `.html` file for example)
261-
1. **Windows/Linux:** May want to add in `overwrite` option for Windows and Linux too. This would require deleting the existing shortcut. Deleting files is something that each OS sucks at in different ways and would require pulling in something like `fs-extra` or similar dependency.
270+
1. **Windows/Linux:** May want to add in `overwrite` option for Windows and Linux too. This would require deleting the existing shortcut. Deleting files is something that each OS sucks at in different ways and would require pulling in something like `fs-extra` or a similar dependency.
262271
1. **OSX:** To my knowledge there is no way to pass in arguments with a shortcut. If anyone knows how, make an issue with details.

0 commit comments

Comments
 (0)