Skip to content

Commit

Permalink
pull in replaceAll fix from refactor/watch-native
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Feb 13, 2025
1 parent 7db94de commit c4d1b0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions native/c/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ libztso.a: ztso.o
zowex: zowex.o libzcn.a libzut.a libzjb.a libzds.a libzusf.a libztso.a
@echo 'Building zowex'
$(CXX) $(CPP_BND_FLAGS) -o $@ $^ > $*.bind.lst
ln -sf $@ ../golang/$(basename $@) || true
ln -sf $@ ../golang/$(basename $@)
@echo 'Copied zowex to golang/'

zowexx: zowex.o libzcn.a libzut.a libzjb.a libzds.a libzusf.a libztso.a
@echo 'Building zowexx'
$(CXX) $(CPP_BND_FLAGS_AUTH) -o $@ $^ > $*.bind.lst
ln -sf $@ ../golang/$(basename $@) || true
ln -sf $@ ../golang/$(basename $@)
@echo 'Copied zowexx to golang/'

zowex.o: zowex.cpp
Expand Down
19 changes: 11 additions & 8 deletions scripts/watchNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ async function deleteFile(remotePath) {
}

conn.sftp((err, sftp) => {
sftp
.deleteFile(remotePath)
.then((res) => resolve())
.catch((err) => console.log(err) && resolve());
sftp.unlink(remotePath, (err) => {
if (err) {
return reject(err);
}

resolve();
});
});
});
}
Expand Down Expand Up @@ -183,7 +186,7 @@ watcher.on("add", async (path, stats) => {
try {
await uploadFile(
path,
p.posix.join(config.deployDirectory, path.replace(p.sep, p.posix.sep))
p.posix.join(config.deployDirectory, path.replaceAll(p.sep, p.posix.sep))
);
} catch (err) {
console.error(" ✘", err);
Expand All @@ -195,18 +198,18 @@ watcher.on("change", async (path, stats) => {
try {
await uploadFile(
path,
p.posix.join(config.deployDirectory, path.replace(p.sep, p.posix.sep))
p.posix.join(config.deployDirectory, path.replaceAll(p.sep, p.posix.sep))
);
} catch (err) {
console.error(" ✘", err);
}
});

watcher.on("unlink", async (path, stats) => {
process.stdout.write(`${Date.now().toLocaleString()} [-] ${path}`);
process.stdout.write(`${new Date().toLocaleString()} [-] ${path}`);
try {
await deleteFile(
p.posix.join(config.deployDirectory, path.replace(p.sep, p.posix.sep))
p.posix.join(config.deployDirectory, path.replaceAll(p.sep, p.posix.sep))
);
} catch (err) {
console.error(" ✘", err);
Expand Down

0 comments on commit c4d1b0c

Please sign in to comment.