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

Commit e318fcd

Browse files
committed
Merge pull request #5828 from rovenman/iss5368
Remove deprecated FileUtils.getFilenameExtension() API
2 parents e04f94f + 99c758b commit e318fcd

2 files changed

Lines changed: 8 additions & 23 deletions

File tree

src/file/FileUtils.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,6 @@ define(function (require, exports, module) {
299299
return baseName.substr(idx + 1);
300300
}
301301

302-
/**
303-
* Similar to getFileExtension(), but includes the leading "." in the returned value.
304-
* @deprecated Use getFileExtension() instead. This API will be removed soon.
305-
*/
306-
function getFilenameExtension(fullPath) {
307-
console.error("Warning: FileUtils.getFilenameExtension() is deprecated. Use FileUtils.getFileExtension() (which omits the '.') instead.");
308-
309-
var ext = getFileExtension(fullPath);
310-
if (ext !== "") {
311-
ext = "." + ext;
312-
}
313-
return ext;
314-
}
315-
316302
/** @const - hard-coded for now, but may want to make these preferences */
317303
var _staticHtmlFileExts = ["htm", "html"],
318304
_serverHtmlFileExts = ["php", "php3", "php4", "php5", "phtm", "phtml", "cfm", "cfml", "asp", "aspx", "jsp", "jspx", "shtm", "shtml"];
@@ -409,6 +395,5 @@ define(function (require, exports, module) {
409395
exports.getDirectoryPath = getDirectoryPath;
410396
exports.getBaseName = getBaseName;
411397
exports.getFileExtension = getFileExtension;
412-
exports.getFilenameExtension = getFilenameExtension;
413398
exports.compareFilenames = compareFilenames;
414399
});

test/spec/FileUtils-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,28 +101,28 @@ define(function (require, exports, module) {
101101
});
102102
});
103103

104-
describe("getFilenameExtension", function () {
104+
describe("getFileExtension", function () {
105105

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

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

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

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

122122
it("should return the extension of a filename containing .", function () {
123-
expect(FileUtils.getFilenameExtension("C:/foo/bar/.baz/jaz.txt")).toBe(".txt");
124-
expect(FileUtils.getFilenameExtension("foo/bar/baz/.jaz.txt")).toBe(".txt");
125-
expect(FileUtils.getFilenameExtension("foo.bar.baz..jaz.txt")).toBe(".txt");
123+
expect(FileUtils.getFileExtension("C:/foo/bar/.baz/jaz.txt")).toBe("txt");
124+
expect(FileUtils.getFileExtension("foo/bar/baz/.jaz.txt")).toBe("txt");
125+
expect(FileUtils.getFileExtension("foo.bar.baz..jaz.txt")).toBe("txt");
126126
});
127127
});
128128
});

0 commit comments

Comments
 (0)