Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit eb9a95d

Browse files
committed
Merge pull request #7170 from adobe/jeff/pflynns-xp-suggestion
Disable File Watchers on XP (For real this time)
2 parents c1c05b8 + d8a574f commit eb9a95d

3 files changed

Lines changed: 26 additions & 13 deletions

File tree

src/filesystem/FileSystem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ define(function (require, exports, module) {
9292
var Directory = require("filesystem/Directory"),
9393
File = require("filesystem/File"),
9494
FileIndex = require("filesystem/FileIndex"),
95+
FileSystemError = require("filesystem/FileSystemError"),
9596
WatchedRoot = require("filesystem/WatchedRoot");
9697

9798
/**
@@ -886,7 +887,7 @@ define(function (require, exports, module) {
886887
callback = callback || function () {};
887888

888889
if (!watchedRoot) {
889-
callback("Root is not watched.");
890+
callback(FileSystemError.ROOT_NOT_WATCHED);
890891
return;
891892
}
892893

src/filesystem/FileSystemError.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ define(function (require, exports, module) {
3535
"use strict";
3636

3737
module.exports = {
38-
UNKNOWN : "Unknown",
39-
INVALID_PARAMS : "InvalidParams",
40-
NOT_FOUND : "NotFound",
41-
NOT_READABLE : "NotReadable",
42-
NOT_WRITABLE : "NotWritable",
43-
OUT_OF_SPACE : "OutOfSpace",
44-
TOO_MANY_ENTRIES : "TooManyEntries",
45-
ALREADY_EXISTS : "AlreadyExists",
46-
CONTENTS_MODIFIED : "ContentsModified"
38+
UNKNOWN : "Unknown",
39+
INVALID_PARAMS : "InvalidParams",
40+
NOT_FOUND : "NotFound",
41+
NOT_READABLE : "NotReadable",
42+
NOT_SUPPORTED : "NotSupported",
43+
NOT_WRITABLE : "NotWritable",
44+
OUT_OF_SPACE : "OutOfSpace",
45+
TOO_MANY_ENTRIES : "TooManyEntries",
46+
ALREADY_EXISTS : "AlreadyExists",
47+
CONTENTS_MODIFIED : "ContentsModified",
48+
ROOT_NOT_WATCHED : "RootNotBeingWatched"
49+
4750
// FUTURE: Add remote connection errors: timeout, not logged in, connection err, etc.
4851
};
4952
});

src/filesystem/impls/appshell/AppshellFileSystem.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ define(function (require, exports, module) {
4646
_domainPath = [_bracketsPath, _modulePath, _nodePath].join("/"),
4747
_nodeDomain = new NodeDomain("fileWatcher", _domainPath);
4848

49+
var _isRunningOnWindowsXP = navigator.userAgent.indexOf("Windows NT 5.") >= 0;
50+
4951
// If the connection closes, notify the FileSystem that watchers have gone offline.
5052
$(_nodeDomain.connection).on("close", function (event, promise) {
5153
if (_offlineCallback) {
@@ -485,11 +487,15 @@ define(function (require, exports, module) {
485487
* cleared when the offlineCallback is called.
486488
*
487489
* @param {function(?string, FileSystemStats=)} changeCallback
488-
* @param {function()=} callback
490+
* @param {function()=} offlineCallback
489491
*/
490492
function initWatchers(changeCallback, offlineCallback) {
491493
_changeCallback = changeCallback;
492494
_offlineCallback = offlineCallback;
495+
496+
if (_isRunningOnWindowsXP && _offlineCallback) {
497+
_offlineCallback();
498+
}
493499
}
494500

495501
/**
@@ -504,6 +510,10 @@ define(function (require, exports, module) {
504510
* @param {function(?string)=} callback
505511
*/
506512
function watchPath(path, callback) {
513+
if (_isRunningOnWindowsXP) {
514+
callback(FileSystemError.NOT_SUPPORTED);
515+
return;
516+
}
507517
appshell.fs.isNetworkDrive(path, function (err, isNetworkDrive) {
508518
if (err || isNetworkDrive) {
509519
callback(FileSystemError.UNKNOWN);
@@ -563,8 +573,7 @@ define(function (require, exports, module) {
563573
*
564574
* @type {boolean}
565575
*/
566-
exports.recursiveWatch = (appshell.platform === "mac" ||
567-
(appshell.platform === "win" && navigator.userAgent.indexOf("Windows NT 5.") === -1));
576+
exports.recursiveWatch = (appshell.platform === "mac" || appshell.platform === "win");
568577

569578
/**
570579
* Indicates whether or not the filesystem should expect and normalize UNC

0 commit comments

Comments
 (0)