Skip to content

Commit

Permalink
Support symlinked plugins on Windows and OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed May 25, 2021
1 parent 58d8c28 commit 2ef3d5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ module.exports = class HotReload extends Plugin {
}

watch(path) {
if (!watchNeeded) return;
if (this.app.vault.adapter.watchers.hasOwnProperty(path)) return;
if (fs.existsSync(path) && fs.statSync(path).isDirectory()) this.app.vault.adapter.startWatchPath(path, false);
const realPath = [this.app.vault.adapter.basePath, path].join("/");
const lstat = fs.lstatSync(realPath);
if (lstat && (watchNeeded || lstat.isSymbolicLink()) && fs.statSync(realPath).isDirectory()) {
this.app.vault.adapter.startWatchPath(path, false);
}
}

async getPluginNames() {
await this.app.plugins.loadManifests();
const plugins = {}, enabled = new Set();
for (const {id, dir} of Object.values(app.plugins.manifests)) {
this.watch(dir);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "hot-reload",
"name": "Hot Reload",
"version": "0.1.7",
"version": "0.1.8",
"minAppVersion": "0.11.13",
"description": "Automatically reload in-development plugins when their files are changed",
"isDesktopOnly": true
Expand Down

0 comments on commit 2ef3d5e

Please sign in to comment.