Skip to content

Commit

Permalink
fix(cosmic-swingset): Use 'junction' symlinks for directories
Browse files Browse the repository at this point in the history
This is needed to symlink directories on Windows without requiring
administrative privileges.
  • Loading branch information
michaelfig committed Feb 22, 2021
1 parent 2721da7 commit 1446df8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/lib/ag-solo/init-basedir.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function initBasedir(
dots += '../';
nm = path.resolve(here, dots, 'node_modules');
}
fs.symlinkSync(nm, path.join(basedir, 'node_modules'));
fs.symlinkSync(nm, path.join(basedir, 'node_modules'), 'junction');

// cosmos-sdk keypair
if (egresses.includes('cosmos')) {
Expand Down
5 changes: 2 additions & 3 deletions packages/cosmic-swingset/lib/ag-solo/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ let swingSetRunning = false;

const fsWrite = promisify(fs.write);
const fsClose = promisify(fs.close);
const mkdir = promisify(fs.mkdir);
const rename = promisify(fs.rename);
const symlink = promisify(fs.symlink);
const unlink = promisify(fs.unlink);
Expand Down Expand Up @@ -97,7 +96,7 @@ async function buildSwingset(
});

const pluginDir = path.resolve('./plugins');
await mkdir(pluginDir, { recursive: true });
fs.mkdirSync(pluginDir, { recursive: true });
const pluginsPrefix = `${pluginDir}${path.sep}`;
const pluginRequire = mod => {
// Ensure they can't traverse out of the plugins prefix.
Expand Down Expand Up @@ -311,7 +310,7 @@ export default async function start(basedir, argv) {

const agWallet = path.dirname(pjs);
const agWalletHtml = path.resolve(agWallet, htmlBasedir);
symlink(agWalletHtml, 'html/wallet').catch(e => {
symlink(agWalletHtml, 'html/wallet', 'junction').catch(e => {
console.error('Cannot link html/wallet:', e);
});

Expand Down

0 comments on commit 1446df8

Please sign in to comment.