2019-11-23 15:10:51 +00:00
|
|
|
import { conf } from "../helpers/ConfigHelper";
|
|
|
|
import { join } from "path";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* User data utilities
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get and returns the URL path to an userdata file
|
|
|
|
*
|
|
|
|
* @param uri Optionnal, defines the URI pointing on the file
|
|
|
|
* @param sysPath Optionnal, defines if system path is required instead of URL
|
|
|
|
* @return The full URL to the userdata file
|
|
|
|
*/
|
|
|
|
export function pathUserData(uri: string = "", sysPath: boolean = false) : string {
|
|
|
|
if(!sysPath)
|
2019-11-23 15:23:29 +00:00
|
|
|
return join(conf().storageURL, uri).replace(":/", "://");
|
2019-11-23 15:10:51 +00:00
|
|
|
else
|
|
|
|
return join(conf().storagePath, uri);
|
|
|
|
}
|