Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return atom.workspace.addOpener((filePath = '') => {
// Check that filePath exists before opening, in case a remote URI was given
if (isPathSupported(filePath) && fs.isFileSync(filePath)) {
return new ArchiveEditor({path: filePath})
}
})
}
export function deserialize({filePath, scale, scrollTop, scrollLeft}) {
if (require('fs-plus').isFileSync(filePath)) {
if (PdfEditorView === null) {
PdfEditorView = require('./pdf-editor-view');
}
return new PdfEditorView(filePath, scale, scrollTop, scrollLeft);
} else {
console.warn("Could not deserialize PDF editor for path '#{filePath}' because that file no longer exists");
}
}
export function deserialize({filePath, uri}) {
if (require('fs-plus').isFileSync(filePath)) {
return new HTMLPreviewView(uri)
}
}
const detectFile = filePath => {
if (fs.isFileSync(filePath)) {
libPath = filePath
}
return !!libPath
}
const detectInDirectory = (...dirs) => detectFile(Path.join(...dirs, 'node_modules', 'prettier', 'index.js'))
function isNewPathValid(previousPath, nextPath) {
if (!isFileSync(nextPath)) return true;
/*
New path exists so check if it points to the same file as the initial
path to see if the case of the file name is being changed on a on a
case insensitive filesystem.
*/
const oldStat = statSync(previousPath);
const newStat = statSync(nextPath);
const haveSamePath = previousPath.toLowerCase() === nextPath.toLowerCase();
const haveSameDev = oldStat.dev === newStat.dev;
const haveSameIno = oldStat.ino === newStat.ino;
return !(haveSamePath && haveSameDev && haveSameIno);
}