Skip to content

Commit a4d54e9

Browse files
authored
Merge pull request #2297 from NativeScript/raikov/fix-2221
Fixes: Provision to watch files in symlinked directories for livesync command
2 parents 8419e85 + d152a46 commit a4d54e9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/services/app-files-updater.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from "path";
22
import * as minimatch from "minimatch";
33
import * as constants from "../constants";
4+
import * as fs from "fs";
45
import Future = require("fibers/future");
56

67
export class AppFilesUpdater {
@@ -77,7 +78,12 @@ export class AppFilesUpdater {
7778
protected copyAppSourceFiles(sourceFiles: string[]): void {
7879
let copyFileFutures = sourceFiles.map(source => {
7980
let destinationPath = path.join(this.appDestinationDirectoryPath, path.relative(this.appSourceDirectoryPath, source));
80-
if (this.fs.getFsStats(source).wait().isDirectory()) {
81+
let exists = fs.lstatSync(source);
82+
if (exists.isSymbolicLink()) {
83+
source = fs.realpathSync(source);
84+
exists = fs.lstatSync(source);
85+
}
86+
if (exists.isDirectory()) {
8187
return this.fs.createDirectory(destinationPath);
8288
}
8389
return this.fs.copyFile(source, destinationPath);

lib/services/livesync/livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class LiveSyncService implements ILiveSyncService {
123123
private partialSync(syncWorkingDirectory: string, onChangedActions: ((event: string, filePath: string, dispatcher: IFutureDispatcher) => void )[]): void {
124124
let that = this;
125125

126-
let gazeWatcher = gaze("**/*", { cwd: syncWorkingDirectory }, function (err: any, watcher: any) {
126+
let gazeWatcher = gaze("**/*", { cwd: syncWorkingDirectory, follow: true }, function (err: any, watcher: any) {
127127
this.on('all', (event: string, filePath: string) => {
128128
fiberBootstrap.run(() => {
129129
that.$dispatcher.dispatch(() => (() => {

0 commit comments

Comments
 (0)