Brackets ist eine andere Art Editor.
Brackets hat ein paar einzigartige Features wie Schnelles Bearbeiten, Live-Vorschau und zahlreiche
weitere, die Sie in anderen Editoren vergeblich suchen werden. Zudem ist Brackets in JavaScript, HTML
- und CSS geschrieben. Das heißt, dass die meisten Brackets-Nutzer dazu in der Lage sind, den Editor
- selbst zu verändern und erweitern. Tatsächlich nutzen wir Brackets täglich, um Brackets zu verbessern.
+ und CSS geschrieben. Das heißt, dass die meisten Brackets-Nutzer dazu in der Lage sind, den Editor selbst
+ zu verändern und zu erweitern. Tatsächlich nutzen wir Brackets täglich, um Brackets zu verbessern.
Lesen Sie weiter, um mehr über die Nutzung der Hauptfeatures zu erfahren.
diff --git a/src/nls/de/strings.js b/src/nls/de/strings.js
index f83e2458928..da5df77e5f4 100644
--- a/src/nls/de/strings.js
+++ b/src/nls/de/strings.js
@@ -32,8 +32,8 @@ define({
// General file io error strings
"GENERIC_ERROR" : "(Fehler {0})",
- "NOT_FOUND_ERR" : "Die Datei konnte nicht gefunden werden.",
- "NOT_READABLE_ERR" : "Die Datei konnte nicht gelesen werden.",
+ "NOT_FOUND_ERR" : "Die Datei/der Ordner konnte nicht gefunden werden.",
+ "NOT_READABLE_ERR" : "Die Datei/der Ordner konnte nicht gelesen werden.",
"EXCEEDS_MAX_FILE_SIZE" : "{APP_NAME} kann keine Dateien öffnen, die größer als {0} MB sind.",
"NO_MODIFICATION_ALLOWED_ERR" : "Der Ziel-Ordner kann nicht verändert werden.",
"NO_MODIFICATION_ALLOWED_ERR_FILE" : "Die Berechtigungen erlauben Ihnen nicht, Veränderungen vorzunehmen.",
@@ -396,7 +396,7 @@ define({
"CMD_QUICK_OPEN" : "Schnell öffnen",
"CMD_GOTO_LINE" : "Gehe zur Zeile",
"CMD_GOTO_DEFINITION" : "Definition schnell finden",
- "CMD_GOTO_FIRST_PROBLEM" : "Zum ersten Fehler/zur ersten Warnung gehen",
+ "CMD_GOTO_FIRST_PROBLEM" : "Zum ersten Problem gehen",
"CMD_TOGGLE_QUICK_EDIT" : "Schnell bearbeiten",
"CMD_TOGGLE_QUICK_DOCS" : "Schnell-Dokumentation",
"CMD_QUICK_EDIT_PREV_MATCH" : "Voriger Treffer",
@@ -628,4 +628,4 @@ define({
"DOCS_MORE_LINK" : "Weiterlesen"
});
-/* Last translated for 893c065b715c211526dcd010c0294e12a8683995 */
+/* Last translated for c292e896761bc7d451a9e3b95bedd20d6b355d77 */
From 2bdbbb5931c05b1e1aee9295b2fcfb22c5a01041 Mon Sep 17 00:00:00 2001
From: TomMalbran
Date: Mon, 15 Dec 2014 23:46:46 -0300
Subject: [PATCH 2/9] Spanish translations for release 1.1
---
src/nls/es/strings.js | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/nls/es/strings.js b/src/nls/es/strings.js
index a93be266e12..3aa9b1ba781 100644
--- a/src/nls/es/strings.js
+++ b/src/nls/es/strings.js
@@ -25,15 +25,15 @@
/*global define */
define({
-
+
/**
* Errors
*/
// General file io error strings
"GENERIC_ERROR" : "(error {0})",
- "NOT_FOUND_ERR" : "No se pudo encontrar el archivo.",
- "NOT_READABLE_ERR" : "No se pudo leer el archivo.",
+ "NOT_FOUND_ERR" : "No se pudo encontrar el archivo/directorio.",
+ "NOT_READABLE_ERR" : "No se pudo leer el archivo/directorio.",
"EXCEEDS_MAX_FILE_SIZE" : "Los archivos de más de {0} MB no se pueden abrir en {APP_NAME}.",
"NO_MODIFICATION_ALLOWED_ERR" : "El directorio de destino no se puede modificar.",
"NO_MODIFICATION_ALLOWED_ERR_FILE" : "Los permisos no permiten hacer modificaciones.",
@@ -49,7 +49,6 @@ define({
"FILENAME" : "nombre de archivo",
"DIRECTORY_NAME" : "nombre de directorio",
-
// Project error strings
"ERROR_LOADING_PROJECT" : "Error abriendo el proyecto",
"OPEN_DIALOG_ERROR" : "Ha ocurrido un error al mostrar el aviso de apertura de archivo. (error {0})",
@@ -295,7 +294,6 @@ define({
"LINTER_TIMED_OUT" : "{0} ha agotado el tiempo después de esperar {1} ms",
"LINTER_FAILED" : "{0} terminó con error: {1}",
-
/**
* Command Name Constants
*/
@@ -396,7 +394,7 @@ define({
"CMD_QUICK_OPEN" : "Apertura rápida",
"CMD_GOTO_LINE" : "Ir a la línea",
"CMD_GOTO_DEFINITION" : "Búsqueda rápida de definición",
- "CMD_GOTO_FIRST_PROBLEM" : "Ir al primer error/advertencia",
+ "CMD_GOTO_FIRST_PROBLEM" : "Ir al primer problema",
"CMD_TOGGLE_QUICK_EDIT" : "Edición rápida",
"CMD_TOGGLE_QUICK_DOCS" : "Documentación rápida",
"CMD_QUICK_EDIT_PREV_MATCH" : "Coincidencia anterior",
@@ -453,7 +451,7 @@ define({
"BASEURL_ERROR_HASH_DISALLOWED" : "La URL base no puede contener hashes como \"{0}\".",
"BASEURL_ERROR_INVALID_CHAR" : "Los caracteres especiales como '{0}' deben codificarse en formato %.",
"BASEURL_ERROR_UNKNOWN_ERROR" : "Error desconocido analizando la URL base",
- "EMPTY_VIEW_HEADER" : "Abra un archivo mientras este panel está enfocado",
+ "EMPTY_VIEW_HEADER" : "Abra un archivo mientras este panel está enfocado",
// Strings for themes-settings.html and themes-general.html
"CURRENT_THEME" : "Tema actual",
From 09457c56a060e14a253568d02eda29cd3291163b Mon Sep 17 00:00:00 2001
From: TomMalbran
Date: Mon, 15 Dec 2014 23:48:06 -0300
Subject: [PATCH 3/9] Updated sha
---
src/nls/es/strings.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nls/es/strings.js b/src/nls/es/strings.js
index 3aa9b1ba781..5764735fc70 100644
--- a/src/nls/es/strings.js
+++ b/src/nls/es/strings.js
@@ -626,4 +626,4 @@ define({
"DOCS_MORE_LINK" : "Más"
});
-/* Last translated for 0b949dd02b87866d54f38631715a4353a8f927e5 */
+/* Last translated for c292e896761bc7d451a9e3b95bedd20d6b355d77 */
From bb4f4d0fdaae509cafd467364947717f0c70cb4d Mon Sep 17 00:00:00 2001
From: Scott Wadden
Date: Tue, 16 Dec 2014 16:37:22 -0400
Subject: [PATCH 4/9] LiveDevMultiBrowser should properly search parent
directories for an index.html.
---
src/LiveDevelopment/LiveDevMultiBrowser.js | 2 +-
.../index.html | 9 +++++++++
.../sub/test.css | 3 +++
test/spec/LiveDevelopmentMultiBrowser-test.js | 12 ++++++++++++
4 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 test/spec/LiveDevelopment-MultiBrowser-test-files/index.html
create mode 100644 test/spec/LiveDevelopment-MultiBrowser-test-files/sub/test.css
diff --git a/src/LiveDevelopment/LiveDevMultiBrowser.js b/src/LiveDevelopment/LiveDevMultiBrowser.js
index 17eed481ddd..af3deb396ea 100644
--- a/src/LiveDevelopment/LiveDevMultiBrowser.js
+++ b/src/LiveDevelopment/LiveDevMultiBrowser.js
@@ -417,7 +417,7 @@ define(function (require, exports, module) {
// We found no good match
if (i === -1) {
// traverse the directory tree up one level
- containingFolder = FileUtils.getDirectoryPath(containingFolder);
+ containingFolder = FileUtils.getDirectoryPath(FileUtils.stripTrailingSlash(containingFolder));
// Are we still inside the project?
if (containingFolder.indexOf(projectRoot) === -1) {
stillInProjectTree = false;
diff --git a/test/spec/LiveDevelopment-MultiBrowser-test-files/index.html b/test/spec/LiveDevelopment-MultiBrowser-test-files/index.html
new file mode 100644
index 00000000000..c4ca4e2a501
--- /dev/null
+++ b/test/spec/LiveDevelopment-MultiBrowser-test-files/index.html
@@ -0,0 +1,9 @@
+
+
+ Test
+
+
+
+
Hello
+
+
diff --git a/test/spec/LiveDevelopment-MultiBrowser-test-files/sub/test.css b/test/spec/LiveDevelopment-MultiBrowser-test-files/sub/test.css
new file mode 100644
index 00000000000..c449d9c6840
--- /dev/null
+++ b/test/spec/LiveDevelopment-MultiBrowser-test-files/sub/test.css
@@ -0,0 +1,3 @@
+body { background-color: red;}
+
+h1 { color: blue; }
diff --git a/test/spec/LiveDevelopmentMultiBrowser-test.js b/test/spec/LiveDevelopmentMultiBrowser-test.js
index f737832a554..f43f848d202 100644
--- a/test/spec/LiveDevelopmentMultiBrowser-test.js
+++ b/test/spec/LiveDevelopmentMultiBrowser-test.js
@@ -102,6 +102,18 @@ define(function (require, exports, module) {
});
});
+ it("should find an index.html in a parent directory", function () {
+ runs(function () {
+ waitsForDone(SpecRunnerUtils.openProjectFiles(["sub/test.css"]), "SpecRunnerUtils.openProjectFiles sub/test.css", 1000);
+ });
+
+ waitsForLiveDevelopmentToOpen();
+
+ runs(function () {
+ expect(LiveDevelopment._getCurrentLiveDoc().doc.url).toMatch(/\/index\.html$/);
+ });
+ });
+
it("should send all external stylesheets as related docs on start-up", function () {
var liveDoc;
runs(function () {
From 22721cb53199f5c33677088cb228dbdc424b5e15 Mon Sep 17 00:00:00 2001
From: Randy Edmunds
Date: Tue, 16 Dec 2014 15:00:35 -0800
Subject: [PATCH 5/9] verify DOM.enable() exists before calling it
---
src/LiveDevelopment/LiveDevelopment.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js
index 466fdfdf77d..692e28dd7a3 100644
--- a/src/LiveDevelopment/LiveDevelopment.js
+++ b/src/LiveDevelopment/LiveDevelopment.js
@@ -1052,7 +1052,8 @@ define(function LiveDevelopment(require, exports, module) {
// Domains for some agents must be enabled first before loading
var enablePromise = Inspector.Page.enable().then(function () {
- Inspector.DOM.enable().then(_enableAgents);
+ var domEnablePromise = Inspector.DOM.enable() || (new $.Deferred()).resolve().promise();
+ domEnablePromise.then(_enableAgents);
});
enablePromise.done(function () {
From 597ffdcdd1d9e0c0d9f6b649845f828bafe47520 Mon Sep 17 00:00:00 2001
From: Randy Edmunds
Date: Tue, 16 Dec 2014 15:20:16 -0800
Subject: [PATCH 6/9] fix condition
---
src/LiveDevelopment/LiveDevelopment.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js
index 692e28dd7a3..f567f79eb0b 100644
--- a/src/LiveDevelopment/LiveDevelopment.js
+++ b/src/LiveDevelopment/LiveDevelopment.js
@@ -1052,7 +1052,7 @@ define(function LiveDevelopment(require, exports, module) {
// Domains for some agents must be enabled first before loading
var enablePromise = Inspector.Page.enable().then(function () {
- var domEnablePromise = Inspector.DOM.enable() || (new $.Deferred()).resolve().promise();
+ var domEnablePromise = Inspector.DOM.enable ? Inspector.DOM.enable() : (new $.Deferred()).resolve().promise();
domEnablePromise.then(_enableAgents);
});
From 6d18e1ef1e8cedf87c9f77383fdd8d9ca94d5093 Mon Sep 17 00:00:00 2001
From: Peter Flynn
Date: Wed, 17 Dec 2014 00:38:03 -0800
Subject: [PATCH 7/9] Fix bug #10200 (Live Preview throws errors on pages with
dynamic LESS) - Make sure every "live document" type implements the same
interface, including the EventDispatcher APIs.
---
.../Documents/CSSPreprocessorDocument.js | 4 ++++
src/LiveDevelopment/Documents/JSDocument.js | 10 +++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/LiveDevelopment/Documents/CSSPreprocessorDocument.js b/src/LiveDevelopment/Documents/CSSPreprocessorDocument.js
index 48af31d5c07..67ac52860a6 100644
--- a/src/LiveDevelopment/Documents/CSSPreprocessorDocument.js
+++ b/src/LiveDevelopment/Documents/CSSPreprocessorDocument.js
@@ -38,6 +38,7 @@ define(function CSSPreprocessorDocumentModule(require, exports, module) {
"use strict";
var _ = require("thirdparty/lodash"),
+ EventDispatcher = require("utils/EventDispatcher"),
CSSUtils = require("language/CSSUtils"),
EditorManager = require("editor/EditorManager"),
HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent"),
@@ -62,6 +63,9 @@ define(function CSSPreprocessorDocumentModule(require, exports, module) {
this.onActiveEditorChange(null, EditorManager.getActiveEditor(), null);
};
+ // CSSPreprocessorDocument doesn't dispatch events, but the "live document" interface requires an on() API
+ EventDispatcher.makeEventDispatcher(CSSPreprocessorDocument.prototype);
+
/** Close the document */
CSSPreprocessorDocument.prototype.close = function close() {
this.doc.off(".CSSPreprocessorDocument");
diff --git a/src/LiveDevelopment/Documents/JSDocument.js b/src/LiveDevelopment/Documents/JSDocument.js
index 26935059936..57ac7791c66 100644
--- a/src/LiveDevelopment/Documents/JSDocument.js
+++ b/src/LiveDevelopment/Documents/JSDocument.js
@@ -45,9 +45,10 @@
define(function JSDocumentModule(require, exports, module) {
"use strict";
- var Inspector = require("LiveDevelopment/Inspector/Inspector");
- var ScriptAgent = require("LiveDevelopment/Agents/ScriptAgent");
- var HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent");
+ var EventDispatcher = require("utils/EventDispatcher"),
+ Inspector = require("LiveDevelopment/Inspector/Inspector"),
+ ScriptAgent = require("LiveDevelopment/Agents/ScriptAgent"),
+ HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent");
/**
* @constructor
@@ -68,6 +69,9 @@ define(function JSDocumentModule(require, exports, module) {
this.editor.on("cursorActivity", this.onCursorActivity);
this.onCursorActivity();
};
+
+ // JSDocument doesn't dispatch events, but the "live document" interface requires having an on() API
+ EventDispatcher.makeEventDispatcher(JSDocument.prototype);
/** Close the document */
JSDocument.prototype.close = function close() {
From 0ca7cc4331724c0a2a71a6c597a22f8cc726bc9d Mon Sep 17 00:00:00 2001
From: RaymondLim
Date: Wed, 17 Dec 2014 09:32:22 -0800
Subject: [PATCH 8/9] Provide the same _enableAgents as failFilter function and
chain the returned promise from DOM.enable.
---
src/LiveDevelopment/LiveDevelopment.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js
index f567f79eb0b..ab24b3a5eac 100644
--- a/src/LiveDevelopment/LiveDevelopment.js
+++ b/src/LiveDevelopment/LiveDevelopment.js
@@ -1052,8 +1052,7 @@ define(function LiveDevelopment(require, exports, module) {
// Domains for some agents must be enabled first before loading
var enablePromise = Inspector.Page.enable().then(function () {
- var domEnablePromise = Inspector.DOM.enable ? Inspector.DOM.enable() : (new $.Deferred()).resolve().promise();
- domEnablePromise.then(_enableAgents);
+ return Inspector.DOM.enable().then(_enableAgents, _enableAgents);
});
enablePromise.done(function () {
From f044e443f70aa58f629ae321e7acc8c4bf335c9b Mon Sep 17 00:00:00 2001
From: Peter Flynn
Date: Wed, 17 Dec 2014 10:42:16 -0800
Subject: [PATCH 9/9] Clean up #10193 fix by sharing code with existing
implementation in LiveDevelopment.js, moving shared code to FileUtils with
unit tests. Also... - fixes an unhit edge case in getParentFolder() (now
getParentDirectory()) that behaves differently across platforms - removes
duplicate copy of getFilenameWithoutExtension() in LiveDevelopment.js (copy
in FileUtils was identical) - add/fix some unit tests for two existing
FileUtils APIs
---
src/LiveDevelopment/LiveDevMultiBrowser.js | 4 +--
src/LiveDevelopment/LiveDevelopment.js | 16 ++--------
src/file/FileUtils.js | 21 +++++++++++--
test/spec/FileUtils-test.js | 36 +++++++++++++++++++++-
4 files changed, 58 insertions(+), 19 deletions(-)
diff --git a/src/LiveDevelopment/LiveDevMultiBrowser.js b/src/LiveDevelopment/LiveDevMultiBrowser.js
index af3deb396ea..d8597449c7a 100644
--- a/src/LiveDevelopment/LiveDevMultiBrowser.js
+++ b/src/LiveDevelopment/LiveDevMultiBrowser.js
@@ -389,7 +389,7 @@ define(function (require, exports, module) {
}
var filteredFiltered = allFiles.filter(function (item) {
- var parent = FileUtils.getDirectoryPath(item.fullPath);
+ var parent = FileUtils.getParentPath(item.fullPath);
return (containingFolder.indexOf(parent) === 0);
});
@@ -417,7 +417,7 @@ define(function (require, exports, module) {
// We found no good match
if (i === -1) {
// traverse the directory tree up one level
- containingFolder = FileUtils.getDirectoryPath(FileUtils.stripTrailingSlash(containingFolder));
+ containingFolder = FileUtils.getParentPath(containingFolder);
// Are we still inside the project?
if (containingFolder.indexOf(projectRoot) === -1) {
stillInProjectTree = false;
diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js
index f567f79eb0b..87e2a8e108a 100644
--- a/src/LiveDevelopment/LiveDevelopment.js
+++ b/src/LiveDevelopment/LiveDevelopment.js
@@ -679,16 +679,6 @@ define(function LiveDevelopment(require, exports, module) {
refPath,
i;
- // TODO: FileUtils.getParentFolder()
- function getParentFolder(path) {
- return path.substring(0, path.lastIndexOf('/', path.length - 2) + 1);
- }
-
- function getFilenameWithoutExtension(filename) {
- var index = filename.lastIndexOf(".");
- return index === -1 ? filename : filename.slice(0, index);
- }
-
// Is the currently opened document already a file we can use for Live Development?
if (doc) {
refPath = doc.file.fullPath;
@@ -715,14 +705,14 @@ define(function LiveDevelopment(require, exports, module) {
}
var filteredFiltered = allFiles.filter(function (item) {
- var parent = getParentFolder(item.fullPath);
+ var parent = FileUtils.getParentPath(item.fullPath);
return (containingFolder.indexOf(parent) === 0);
});
var filterIndexFile = function (fileInfo) {
if (fileInfo.fullPath.indexOf(containingFolder) === 0) {
- if (getFilenameWithoutExtension(fileInfo.name) === "index") {
+ if (FileUtils.getFilenameWithoutExtension(fileInfo.name) === "index") {
if (hasOwnServerForLiveDevelopment) {
if ((FileUtils.isServerHtmlFileExt(fileInfo.name)) ||
(FileUtils.isStaticHtmlFileExt(fileInfo.name))) {
@@ -743,7 +733,7 @@ define(function LiveDevelopment(require, exports, module) {
// We found no good match
if (i === -1) {
// traverse the directory tree up one level
- containingFolder = getParentFolder(containingFolder);
+ containingFolder = FileUtils.getParentPath(containingFolder);
// Are we still inside the project?
if (containingFolder.indexOf(projectRoot) === -1) {
stillInProjectTree = false;
diff --git a/src/file/FileUtils.js b/src/file/FileUtils.js
index 2bcf3727f63..21b6fdaad4e 100644
--- a/src/file/FileUtils.js
+++ b/src/file/FileUtils.js
@@ -443,7 +443,7 @@ define(function (require, exports, module) {
}
/**
- * Get the parent directory of a file. If a directory is passed in the directory is returned.
+ * Get the parent directory of a file. If a directory is passed, the SAME directory is returned.
* @param {string} fullPath full path to a file or directory
* @return {string} Returns the path to the parent directory of a file or the path of a directory,
* including trailing "/"
@@ -453,8 +453,22 @@ define(function (require, exports, module) {
}
/**
- * Get the file name without the extension.
- * @param {string} filename File name of a file or directory
+ * Get the parent folder of the given file/folder path. Differs from getDirectoryPath() when 'fullPath'
+ * is a directory itself: returns its parent instead of the original path. (Note: if you already have a
+ * FileSystemEntry, it's faster to use entry.parentPath instead).
+ * @param {string} fullPath full path to a file or directory
+ * @return {string} Path of containing folder (including trailing "/"); or "" if path was the root
+ */
+ function getParentPath(fullPath) {
+ if (fullPath === "/") {
+ return "";
+ }
+ return fullPath.substring(0, fullPath.lastIndexOf("/", fullPath.length - 2) + 1);
+ }
+
+ /**
+ * Get the file name without the extension. Returns "" if name starts with "."
+ * @param {string} filename File name of a file or directory, without preceding path
* @return {string} Returns the file name without the extension
*/
function getFilenameWithoutExtension(filename) {
@@ -559,6 +573,7 @@ define(function (require, exports, module) {
exports.isStaticHtmlFileExt = isStaticHtmlFileExt;
exports.isServerHtmlFileExt = isServerHtmlFileExt;
exports.getDirectoryPath = getDirectoryPath;
+ exports.getParentPath = getParentPath;
exports.getBaseName = getBaseName;
exports.getRelativeFilename = getRelativeFilename;
exports.getFilenameWithoutExtension = getFilenameWithoutExtension;
diff --git a/test/spec/FileUtils-test.js b/test/spec/FileUtils-test.js
index 30930c1687c..9df9f762588 100644
--- a/test/spec/FileUtils-test.js
+++ b/test/spec/FileUtils-test.js
@@ -85,7 +85,30 @@ define(function (require, exports, module) {
});
it("should return the unchanged directory of a posix directory path", function () {
- expect(FileUtils.getDirectoryPath("C:/foo/bar/")).toBe("C:/foo/bar/");
+ expect(FileUtils.getDirectoryPath("/foo/bar/")).toBe("/foo/bar/");
+ });
+
+ it("should return the unchanged directory of a root path", function () {
+ expect(FileUtils.getDirectoryPath("C:/")).toBe("C:/");
+ expect(FileUtils.getDirectoryPath("/")).toBe("/");
+ });
+ });
+
+ describe("getParentPath", function () {
+
+ it("should get the parent directory of a normalized file path", function () {
+ expect(FileUtils.getParentPath("C:/foo/bar/baz.txt")).toBe("C:/foo/bar/");
+ expect(FileUtils.getParentPath("/foo/bar/baz.txt")).toBe("/foo/bar/");
+ });
+
+ it("should return the parent directory of a normalized directory path", function () {
+ expect(FileUtils.getParentPath("C:/foo/bar/")).toBe("C:/foo/");
+ expect(FileUtils.getParentPath("/foo/bar/")).toBe("/foo/");
+ });
+
+ it("should return '' given a root path", function () {
+ expect(FileUtils.getParentPath("C:/")).toBe("");
+ expect(FileUtils.getParentPath("/")).toBe("");
});
});
@@ -142,6 +165,17 @@ define(function (require, exports, module) {
expect(FileUtils.getFileExtension("foo.bar.baz..jaz.txt")).toBe("txt");
});
});
+
+ describe("getFilenameWithoutExtension", function () {
+
+ it("should remove last extension segment only", function () {
+ expect(FileUtils.getFilenameWithoutExtension("foo.txt")).toBe("foo");
+ expect(FileUtils.getFilenameWithoutExtension("foo.min.txt")).toBe("foo.min");
+ expect(FileUtils.getFilenameWithoutExtension("foo")).toBe("foo");
+
+ expect(FileUtils.getFilenameWithoutExtension(".foo")).toBe("");
+ });
+ });
describe("getSmartFileExtension", function () {