Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function configureLocalSync (archive, userSettings) {
var oldLocalSyncSettings = archive.localSyncSettings
archive.localSyncSettings = getLocalSyncSettings(archive, userSettings)
if (!isEqual(archive.localSyncSettings, oldLocalSyncSettings)) {
// configure the local folder watcher if a change occurred
folderSync.configureFolderToArchiveWatcher(archive)
}
if (!archive.localSyncSettings || !archive.localSyncSettings.isUsingInternal) {
// clear the internal directory if it's not in use
jetpack.removeAsync(getInternalLocalSyncPath(archive))
}
}
async function migrate() {
const olderAppName = 'Rocket.Chat+';
const dirName = process.env.NODE_ENV === 'production' ? olderAppName : `${ olderAppName } (${ process.env.NODE_ENV })`;
const olderUserDataPath = path.join(app.getPath('appData'), dirName);
try {
await jetpack.copyAsync(olderUserDataPath, app.getPath('userData'), { overwrite: true });
await jetpack.removeAsync(olderUserDataPath);
} catch (error) {
if (jetpack.exists(olderUserDataPath)) {
throw error;
}
console.log('No data to migrate.');
}
}
async function retireLogFile (num) {
try {
var p = getLogPath(num)
var info = await jetpack.inspectAsync(p)
if (info && info.type === 'file') {
await jetpack.removeAsync(p)
}
} catch (err) {
console.error('retireLogFile failed', num, err)
}
}
exports.deleteArchive = async function (key) {
const path = getArchiveMetaPath(key)
const info = await jetpack.inspectTreeAsync(path)
await Promise.all([
db.run(`DELETE FROM archives WHERE key=?`, key),
db.run(`DELETE FROM archives_meta WHERE key=?`, key),
db.run(`DELETE FROM archives_meta_type WHERE key=?`, key),
jetpack.removeAsync(path),
jetpack.removeAsync(getInternalLocalSyncPath(key))
])
return info.size
}
export async function deleteArchive (key) {
const path = getArchiveMetaPath(key)
const info = await jetpack.inspectTreeAsync(path)
await Promise.all([
db.run(`DELETE FROM archives WHERE key=?`, key),
db.run(`DELETE FROM archives_meta WHERE key=?`, key),
jetpack.removeAsync(path)
])
return info ? info.size : 0
}
task('icons:clean', async () => {
await removeAsync('src/public/images/tray/darwin');
await removeAsync('src/public/images/tray/darwin-dark');
await removeAsync('src/public/images/tray/linux');
await removeAsync('src/public/images/tray/win32');
});
task('icons:clean', async () => {
await removeAsync('src/public/images/tray/darwin');
await removeAsync('src/public/images/tray/darwin-dark');
await removeAsync('src/public/images/tray/linux');
await removeAsync('src/public/images/tray/win32');
});
exports.deleteArchive = async function (key) {
const path = getArchiveMetaPath(key)
const info = await jetpack.inspectTreeAsync(path)
await Promise.all([
db.run(`DELETE FROM archives WHERE key=?`, key),
db.run(`DELETE FROM archives_meta WHERE key=?`, key),
db.run(`DELETE FROM archives_meta_type WHERE key=?`, key),
jetpack.removeAsync(path),
jetpack.removeAsync(getInternalLocalSyncPath(key))
])
return info.size
}
gulp.task('icons:clean', async () => {
await jetpack.removeAsync('src/public/images/tray/darwin');
await jetpack.removeAsync('src/public/images/tray/darwin-dark');
await jetpack.removeAsync('src/public/images/tray/linux');
await jetpack.removeAsync('src/public/images/tray/win32');
});