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

Remove deprecated FileUtils.getFilenameExtension() API #5828

Merged
merged 2 commits into from
Nov 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/file/FileUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,20 +369,6 @@ define(function (require, exports, module) {
return baseName.substr(idx + 1);
}

/**
* Similar to getFileExtension(), but includes the leading "." in the returned value.
* @deprecated Use getFileExtension() instead. This API will be removed soon.
*/
function getFilenameExtension(fullPath) {
console.error("Warning: FileUtils.getFilenameExtension() is deprecated. Use FileUtils.getFileExtension() (which omits the '.') instead.");

var ext = getFileExtension(fullPath);
if (ext !== "") {
ext = "." + ext;
}
return ext;
}

/** @const - hard-coded for now, but may want to make these preferences */
var _staticHtmlFileExts = ["htm", "html"],
_serverHtmlFileExts = ["php", "php3", "php4", "php5", "phtm", "phtml", "cfm", "cfml", "asp", "aspx", "jsp", "jspx", "shtm", "shtml"];
Expand Down Expand Up @@ -481,6 +467,5 @@ define(function (require, exports, module) {
exports.getDirectoryPath = getDirectoryPath;
exports.getBaseName = getBaseName;
exports.getFileExtension = getFileExtension;
exports.getFilenameExtension = getFilenameExtension;
exports.compareFilenames = compareFilenames;
});
16 changes: 8 additions & 8 deletions test/spec/FileUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,28 @@ define(function (require, exports, module) {
});
});

describe("getFilenameExtension", function () {
describe("getFileExtension", function () {

it("should get the extension of a normalized win file path", function () {
expect(FileUtils.getFilenameExtension("C:/foo/bar/baz.txt")).toBe(".txt");
expect(FileUtils.getFileExtension("C:/foo/bar/baz.txt")).toBe("txt");
});

it("should get the extension of a posix file path", function () {
expect(FileUtils.getFilenameExtension("/foo/bar/baz.txt")).toBe(".txt");
expect(FileUtils.getFileExtension("/foo/bar/baz.txt")).toBe("txt");
});

it("should return empty extension for a normalized win directory path", function () {
expect(FileUtils.getFilenameExtension("C:/foo/bar/")).toBe("");
expect(FileUtils.getFileExtension("C:/foo/bar/")).toBe("");
});

it("should return empty extension for a posix directory path", function () {
expect(FileUtils.getFilenameExtension("bar")).toBe("");
expect(FileUtils.getFileExtension("bar")).toBe("");
});

it("should return the extension of a filename containing .", function () {
expect(FileUtils.getFilenameExtension("C:/foo/bar/.baz/jaz.txt")).toBe(".txt");
expect(FileUtils.getFilenameExtension("foo/bar/baz/.jaz.txt")).toBe(".txt");
expect(FileUtils.getFilenameExtension("foo.bar.baz..jaz.txt")).toBe(".txt");
expect(FileUtils.getFileExtension("C:/foo/bar/.baz/jaz.txt")).toBe("txt");
expect(FileUtils.getFileExtension("foo/bar/baz/.jaz.txt")).toBe("txt");
expect(FileUtils.getFileExtension("foo.bar.baz..jaz.txt")).toBe("txt");
});
});
});
Expand Down