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

Commit 8ab46c2

Browse files
committed
Merge pull request #7522 from adobe/zaggino/fix-less-loading
fix loading of less imports on win, linux and mac
2 parents ea16d5c + 87745c7 commit 8ab46c2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/utils/ExtensionUtils.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
define(function (require, exports, module) {
3232
"use strict";
3333

34+
var FileSystem = require("filesystem/FileSystem");
35+
3436
/**
3537
* Appends a <style> tag to the document's head.
3638
*
@@ -66,6 +68,18 @@ define(function (require, exports, module) {
6668
return $link[0];
6769
}
6870

71+
/**
72+
* getModuleUrl returns different urls for win platform
73+
* so that's why we need a different check here
74+
* @see getModuleUrl()
75+
* @param {!string} pathOrUrl that should be checked if it's absolute
76+
* @return {!boolean} returns true if pathOrUrl is absolute url on win platform
77+
* or when it's absolute path on other platforms
78+
*/
79+
function isAbsolutePathOrUrl(pathOrUrl) {
80+
return brackets.platform === "win" ? PathUtils.isAbsoluteUrl(pathOrUrl) : FileSystem.isAbsolutePath(pathOrUrl);
81+
}
82+
6983
/**
7084
* Parses LESS code and returns a promise that resolves with plain CSS code.
7185
*
@@ -91,7 +105,7 @@ define(function (require, exports, module) {
91105
rootpath: dir
92106
};
93107

94-
if (PathUtils.isAbsoluteUrl(url)) {
108+
if (isAbsolutePathOrUrl(url)) {
95109
options.currentFileInfo = {
96110
currentDirectory: dir,
97111
entryPath: dir,
@@ -161,7 +175,7 @@ define(function (require, exports, module) {
161175
* @return {!$.Promise} A promise object that is resolved with the contents of the requested file
162176
**/
163177
function loadFile(module, path) {
164-
var url = PathUtils.isAbsoluteUrl(path) ? path : getModuleUrl(module, path),
178+
var url = isAbsolutePathOrUrl(path) ? path : getModuleUrl(module, path),
165179
promise = $.get(url);
166180

167181
return promise;

0 commit comments

Comments
 (0)