Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tempFileWriteStream.on('close', resolve)
tempFileWriteStream.on('error', reject)
})
// Load a `Database` from the file to check that it's valid.
await new JsonDatabase().load(tempFile.path, () => noopTransformer)
// Replace the old LSIF file with the new file.
try {
await fs.mkdir(STORAGE_ROOT)
} catch (e) {
if (e.code !== 'EEXIST') {
throw e
}
}
await moveFile(tempFile.path, diskKey({ repository, commit }))
// Evict the old `Database` from the LRU cache to cause it to pick up the new LSIF data from disk.
dbLRU.del(diskKey({ repository, commit }))
res.send('Upload successful.')
})
if (
fs
.statSync(path.join(extractDest, element, deeperEle))
.isDirectory()
) {
const newerContents = fs.readdirSync(
path.join(extractDest, element, deeperEle)
);
for (let evenDeeperEle of newerContents) {
moveFile.sync(
path.join(extractDest, element, deeperEle, evenDeeperEle),
path.join(coreDataDir, element, deeperEle, evenDeeperEle)
);
}
} else {
moveFile.sync(
path.join(extractDest, element, deeperEle),
path.join(coreDataDir, element, deeperEle)
);
}
}
} else {
moveFile.sync(
path.join(extractDest, element),
path.join(coreDataDir, element)
);
}
}
console.log('Moved Successfully');
} catch (e) {
console.log('Moving Extracted Content Error', e);
throw e;
);
for (let evenDeeperEle of newerContents) {
moveFile.sync(
path.join(extractDest, element, deeperEle, evenDeeperEle),
path.join(coreDataDir, element, deeperEle, evenDeeperEle)
);
}
} else {
moveFile.sync(
path.join(extractDest, element, deeperEle),
path.join(coreDataDir, element, deeperEle)
);
}
}
} else {
moveFile.sync(
path.join(extractDest, element),
path.join(coreDataDir, element)
);
}
}
console.log('Moved Successfully');
} catch (e) {
console.log('Moveing Extracted Content Error', e);
}
}
export function moveFile(sourcePath: string, destinationPath: string): void {
if (fileExists(destinationPath)) {
throw Error(translations["file-exists"]);
}
mv.sync(sourcePath, destinationPath);
}
const recentContents = fs.readdirSync(extractDest);
try {
for (let element of recentContents) {
if (fs.statSync(path.join(extractDest, element)).isDirectory()) {
const newcontents = fs.readdirSync(path.join(extractDest, element));
for (let deeperEle of newcontents) {
if (
fs
.statSync(path.join(extractDest, element, deeperEle))
.isDirectory()
) {
const newerContents = fs.readdirSync(
path.join(extractDest, element, deeperEle)
);
for (let evenDeeperEle of newerContents) {
moveFile.sync(
path.join(extractDest, element, deeperEle, evenDeeperEle),
path.join(coreDataDir, element, deeperEle, evenDeeperEle)
);
}
} else {
moveFile.sync(
path.join(extractDest, element, deeperEle),
path.join(coreDataDir, element, deeperEle)
);
}
}
} else {
moveFile.sync(
path.join(extractDest, element),
path.join(coreDataDir, element)
);
const recentContents = fs.readdirSync(extractDest);
try {
for (let element of recentContents) {
if (fs.statSync(path.join(extractDest, element)).isDirectory()) {
const newcontents = fs.readdirSync(path.join(extractDest, element));
for (let deeperEle of newcontents) {
if (
fs
.statSync(path.join(extractDest, element, deeperEle))
.isDirectory()
) {
const newerContents = fs.readdirSync(
path.join(extractDest, element, deeperEle)
);
for (let evenDeeperEle of newerContents) {
moveFile.sync(
path.join(extractDest, element, deeperEle, evenDeeperEle),
path.join(coreDataDir, element, deeperEle, evenDeeperEle)
);
}
} else {
moveFile.sync(
path.join(extractDest, element, deeperEle),
path.join(coreDataDir, element, deeperEle)
);
}
}
} else {
moveFile.sync(
path.join(extractDest, element),
path.join(coreDataDir, element)
);