Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33567f8

Browse files
authored
Merge pull request meteor#8500 from abernix/abernix/wsl-fs-fix
Be more understanding of Windows' filesystem limitations.
2 parents 20baddf + 78364d5 commit 33567f8

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

circle.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
checkout:
22
post:
3-
- git submodule update --init
3+
# https://discuss.circleci.com/t/git-submodule-url-isnt-playing-nice-with-the-cache/549/3
4+
- git submodule sync
5+
- git submodule update --init --recursive || (rm -fr .git/config .git/modules && git submodule deinit -f . && git submodule update --init --recursive)
46

57
dependencies:
68
pre:

tools/fs/files.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ files.existsSync = function (path, callback) {
16641664
return !! files.statOrNull(path);
16651665
};
16661666

1667-
if (process.platform === "win32") {
1667+
if (files.isWindowsLikeFilesystem()) {
16681668
var rename = files.rename;
16691669

16701670
files.rename = function (from, to) {
@@ -1677,7 +1677,7 @@ if (process.platform === "win32") {
16771677
rename(from, to);
16781678
success = true;
16791679
} catch (err) {
1680-
if (err.code !== 'EPERM') {
1680+
if (err.code !== 'EPERM' && err.code !== 'EACCES') {
16811681
throw err;
16821682
}
16831683
}

tools/static-assets/server/mini-files.js

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ var assert = require("assert");
1313
// after bootup (since they block all concurrency!)
1414
var files = module.exports;
1515

16+
// Detect that we are on a Windows-like Filesystem, such as that in a WSL
17+
// (Windows Subsystem for Linux) even if it otherwise looks like we're on Unix.
18+
// https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
19+
var isWindowsLikeFilesystem = function () {
20+
return process.platform === "win32" ||
21+
(os.release().indexOf("Microsoft") > -1);
22+
};
23+
1624
var toPosixPath = function (p, partialPath) {
1725
// Sometimes, you can have a path like \Users\IEUser on windows, and this
1826
// actually means you want C:\Users\IEUser
@@ -115,6 +123,8 @@ files.pathSep = '/';
115123
files.pathDelimiter = ':';
116124
files.pathOsDelimiter = path.delimiter;
117125

126+
files.isWindowsLikeFilesystem = isWindowsLikeFilesystem;
127+
118128
files.convertToStandardPath = convertToStandardPath;
119129
files.convertToOSPath = convertToOSPath;
120130
files.convertToWindowsPath = toDosPath;

0 commit comments

Comments
 (0)