mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Add deprecated shims for invalid args to node path functions
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Thomas Johansen
parent
e7444b1ebe
commit
c876fd76f8
@@ -1,5 +1,39 @@
|
||||
const path = require('path')
|
||||
const electron = require('electron')
|
||||
|
||||
const dirname = path.dirname
|
||||
path.dirname = function (path) {
|
||||
if (typeof path !== 'string') {
|
||||
path = '' + path
|
||||
const Grim = require('grim')
|
||||
Grim.deprecate('Argument to `path.dirname` must be a string')
|
||||
}
|
||||
|
||||
return dirname(path)
|
||||
}
|
||||
|
||||
const extname = path.extname
|
||||
path.extname = function (path) {
|
||||
if (typeof path !== 'string') {
|
||||
path = '' + path
|
||||
const Grim = require('grim')
|
||||
Grim.deprecate('Argument to `path.extname` must be a string')
|
||||
}
|
||||
|
||||
return extname(path)
|
||||
}
|
||||
|
||||
const basename = path.basename
|
||||
path.basename = function (path, ext) {
|
||||
if (typeof path !== 'string' || (ext !== undefined && typeof ext !== 'string')) {
|
||||
path = '' + path
|
||||
const Grim = require('grim')
|
||||
Grim.deprecate('Arguments to `path.basename` must be strings')
|
||||
}
|
||||
|
||||
return basename(path, ext)
|
||||
}
|
||||
|
||||
electron.ipcRenderer.sendChannel = function () {
|
||||
const Grim = require('grim')
|
||||
Grim.deprecate('Use `ipcRenderer.send` instead of `ipcRenderer.sendChannel`')
|
||||
|
||||
Reference in New Issue
Block a user