mirror of
https://github.com/Swatinem/rust-cache
synced 2025-09-03 10:08:16 +00:00
fix paths for cache dir
This commit is contained in:
parent
b37d2821f8
commit
64b8867183
2 changed files with 28 additions and 19 deletions
24
src/save.ts
24
src/save.ts
|
@ -42,14 +42,19 @@ async function run() {
|
|||
// Save the incremental cache before we delete it
|
||||
if (config.incremental) {
|
||||
core.info(`... Saving incremental cache ...`);
|
||||
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
|
||||
for (const paths of config.incrementalPaths) {
|
||||
await saveIncrementalDirs(paths);
|
||||
}
|
||||
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
|
||||
for (const path of config.incrementalPaths) {
|
||||
core.debug(` deleting ${path}`);
|
||||
await rm(path);
|
||||
try {
|
||||
core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`);
|
||||
for (const paths of config.incrementalPaths) {
|
||||
await saveIncrementalDirs(paths);
|
||||
}
|
||||
await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey);
|
||||
for (const path of config.incrementalPaths) {
|
||||
core.debug(` deleting ${path}`);
|
||||
await rm(path);
|
||||
}
|
||||
} catch (e) {
|
||||
core.debug(`Failed to save incremental cache`);
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,9 +117,8 @@ async function macOsWorkaround() {
|
|||
}
|
||||
|
||||
|
||||
async function saveIncrementalDirs(profileDir: string) {
|
||||
async function saveIncrementalDirs(incrementalDir: string) {
|
||||
// Traverse the incremental folder recursively and collect the modified times in a map
|
||||
const incrementalDir = path.join(profileDir, "incremental");
|
||||
const modifiedTimes = new Map<string, number>();
|
||||
const fillModifiedTimes = async (dir: string) => {
|
||||
const dirEntries = await fs.promises.opendir(dir);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue