mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-31 01:58:39 +01:00
refactor filesystem.js to use isWindowsOS()
This commit is contained in:
parent
95e56cd9c9
commit
de2053f988
@ -160,6 +160,10 @@ const sanitizeDirectoryName = (name) => {
|
||||
return name.replace(/[<>:"/\\|?*\x00-\x1F]+/g, '-');
|
||||
};
|
||||
|
||||
const isWindowsOS = () => {
|
||||
return os.platform() === 'win32';
|
||||
}
|
||||
|
||||
const safeToRename = (oldPath, newPath) => {
|
||||
try {
|
||||
// If the new path doesn't exist, it's safe to rename
|
||||
@ -170,7 +174,7 @@ const safeToRename = (oldPath, newPath) => {
|
||||
const oldStat = fs.statSync(oldPath);
|
||||
const newStat = fs.statSync(newPath);
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
if (isWindowsOS()) {
|
||||
// Windows-specific comparison:
|
||||
// Check if both files have the same birth time, size (Since, Win FAT-32 doesn't use inodes)
|
||||
|
||||
@ -204,5 +208,6 @@ module.exports = {
|
||||
searchForFiles,
|
||||
searchForBruFiles,
|
||||
sanitizeDirectoryName,
|
||||
isWindowsOS,
|
||||
safeToRename
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user