[core] Add getFilePath to LocalStore
This commit is contained in:
1 parent
5db407d750
commit
5684665123
3 files changed
+10
-2
No files matched your search
@@ -52,8 +52,7 @@ export class LocalSessionConfigRepository extends ISessionConfigRepository {
|
||||
}
|
||||
|
||||
private getFilePath(sessionName): string {
|
||||
const folder = this.store.getSessionDirectory(sessionName);
|
||||
return path.join(folder, this.FILENAME);
|
||||
return this.store.getFilePath(sessionName, this.FILENAME);
|
||||
}
|
||||
|
||||
async delete(sessionName: string): Promise<void> {
|
||||
|
||||
@@ -17,4 +17,9 @@ export abstract class LocalStore extends DataStore {
|
||||
* Get the directory where the session data is stored
|
||||
*/
|
||||
abstract getSessionDirectory(name: string): string;
|
||||
|
||||
/**
|
||||
* Get the file path for a session
|
||||
*/
|
||||
abstract getFilePath(session: string, file: string): string;
|
||||
}
|
||||
@@ -45,6 +45,10 @@ export class LocalStoreCore extends LocalStore {
|
||||
return this.getDirectoryPath(name);
|
||||
}
|
||||
|
||||
getFilePath(session: string, file: string): string {
|
||||
return path.join(this.getSessionDirectory(session), file);
|
||||
}
|
||||
|
||||
protected getDirectoryPath(name: string): string {
|
||||
const suffix = crypto.createHash('md5').update(name).digest('hex');
|
||||
return path.join(this.getEngineDirectory(), `${name}-${suffix}`);
|
||||
|
||||
Reference in new issue
Block a user