Object AppPaths
-
- All Implemented Interfaces:
public class AppPathsCreated by vincent on 18-3-23. Copyright @ 2013-2023 Platon AI. All rights reserved
-
-
Field Summary
-
Method Summary
Modifier and Type Method Description final Pathresolve(Path base, String first, String more)Resolve the given path parts to a path. final Pathget(String first, String more)Converts a path string, or a sequence of strings that when joined form a path string, to a Path, but only in the application's home directory. final PathgetTmpDirectory(String first, String more)Get a path of the application's temporary directory. final PathgetTmp(String first, String more)final PathgetRandomTmpDirectory(String prefix, String suffix)Get a random path of the process's temporary directory. final PathgetRandomTmp(String prefix, String suffix)final PathgetProcTmpDirectory(String first, String more)Get a path of the process's temporary directory. final PathgetProcTmp(String first, String more)final PathgetProcTmpTmpDirectory(String first, String more)Get a path of the temporary directory in the process's temporary directory. final PathgetProcTmpTmp(String first, String more)final PathgetRandomProcTmpTmpDirectory(String prefix, String suffix)Get a path of the temporary directory in the process's temporary directory. final PathgetRandomProcTmpTmp(String prefix, String suffix)final PathgetContextGroupDir(String group)final PathgetContextBaseDir(String group, BrowserType browserType)final PathgetTmpContextGroupDir(String group)final PathgetTmpContextBaseDir(String group, BrowserType browserType)final Stringrandom(String prefix, String suffix)Generates a random string that is compatible with file paths and can be used as a file name. final Stringhex(String uri, String prefix, String suffix)Generates a path-compatible, hex string that can be used as a file name. final Stringmd5Hex(String uri)Generates a path-compatible, hex string that can be used as a file name. final StringfileId(String uri)final PathmockPagePath(String uri)Create a mock page path. final StringfromHost(URL url)Create a filename compatible string from the given url. final StringfromHost(String url)Create a filename compatible string from the given url. final StringfromDomain(String url)final StringfromUri(String uri, String prefix, String suffix)Create a filename compatible string from the given uri. final PathuniqueSymbolicLinkForUri(String uri, String suffix)Create a symbolic link from the given uri. final PathgetSYS_TMP_DIR()final PathgetSYS_USER_DIR()final PathgetSYS_USER_HOME()final PathgetSYSTEM_DEFAULT_BROWSER_DATA_DIR_PLACEHOLDER()The directory for the user's default browser. final PathgetSYSTEM_DEFAULT_BROWSER_CONTEXT_DIR_PLACEHOLDER()final PathgetSYS_TMP_LINKS_DIR()final PathgetDATA_DIR()final PathgetCONFIG_DIR()final PathgetBROWSER_DATA_DIR()final PathgetCHROME_DATA_DIR_PROTOTYPE()final PathgetCONTEXT_DEFAULT_DIR()final PathgetLOCAL_DATA_DIR()final PathgetLOCAL_STORAGE_DIR()final PathgetLOCAL_TEST_DATA_DIR()final PathgetLOCAL_TEST_WEB_PAGE_DIR()final PathgetTMP_DIR()final PathgetPROC_TMP_DIR()final PathgetPROC_TMP_TMP_DIR()final PathgetCACHE_DIR()final PathgetWEB_CACHE_DIR()final PathgetDOC_EXPORT_DIR()final PathgetWEB_SCREENSHOT_DIR()final PathgetFILE_CACHE_DIR()final PathgetPROMPT_CACHE_DIR()final PathgetREPORT_DIR()final PathgetMETRICS_DIR()final PathgetSCRIPT_DIR()final PathgetTEST_DIR()final PathgetCONTEXT_BASE_DIR()final PathgetCONTEXT_GROUP_BASE_DIR()final PathgetCONTEXT_DEFAULT_GROUP_DIR()final PathgetCONTEXT_TMP_DIR()final PathgetCONTEXT_TMP_GROUP_BASE_DIR()final PathgetCONTEXT_TMP_DEFAULT_GROUP_DIR()final PathgetPROXY_BASE_DIR()Proxy directory final PathgetENABLED_PROVIDER_DIR()final PathgetAVAILABLE_PROVIDER_DIR()final PathgetENABLED_PROXY_DIR()final PathgetAVAILABLE_PROXY_DIR()final PathgetPROXY_ARCHIVE_DIR()final PathgetPROXY_BANNED_HOSTS_FILE()final PathgetPROXY_BANNED_SEGMENTS_FILE()final PathgetPROXY_BAN_STRATEGY()final PathgetPATH_LOCAL_COMMAND()final PathgetPATH_BANNED_URLS()final PathgetPATH_UNREACHABLE_HOSTS()-
-
Method Detail
-
resolve
final Path resolve(Path base, String first, String more)
Resolve the given path parts to a path. Copy from JDK 22 for backward compatibility.
-
get
final Path get(String first, String more)
Converts a path string, or a sequence of strings that when joined form a path string, to a Path, but only in the application's home directory.
- Parameters:
first-the path string or initial part of the path stringmore-additional strings to be joined to form the path string- Returns:
the resulting Path
-
getTmpDirectory
final Path getTmpDirectory(String first, String more)
Get a path of the application's temporary directory.
A typical application temporary directory is:
$env:Temp/pulsar-$env:USERNAME/TODO: fix me: assertTrue(path2.startsWith(AppPaths.TMP_DIR))
assertTrue(path2.startsWith(AppPaths.TMP_DIR), "$path -> $path2")- Parameters:
first- the first part of the pathmore- the rest parts of the path
-
getTmp
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.getTmpDirectory(first, *more)")) final Path getTmp(String first, String more)
-
getRandomTmpDirectory
final Path getRandomTmpDirectory(String prefix, String suffix)
Get a random path of the process's temporary directory.
A typical process temporary directory is:
$env:TMP/pulsar-$env:USERNAME/- Parameters:
prefix- the prefix of the directory namesuffix- the suffix of the directory name- Returns:
the path in the process's temporary directory
-
getRandomTmp
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.getRandomTmpDirectory(first, *more)")) final Path getRandomTmp(String prefix, String suffix)
-
getProcTmpDirectory
final Path getProcTmpDirectory(String first, String more)
Get a path of the process's temporary directory.
A typical process temporary directory is:
$env:TMP/pulsar-$env:USERNAME/- Parameters:
first- the first part of the pathmore- the rest parts of the path- Returns:
the path in the process's temporary directory
-
getProcTmp
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.getProcTmpDirectory(first, *more)")) final Path getProcTmp(String first, String more)
-
getProcTmpTmpDirectory
final Path getProcTmpTmpDirectory(String first, String more)
Get a path of the temporary directory in the process's temporary directory.
A typical process temporary directory is:
$env:TMP/pulsar-$env:USERNAME/And the tmp-tmp directory is:
$env:TMP/pulsar-$env:USERNAME/tmp@param first the first part of the path
- Parameters:
more- the rest parts of the path- Returns:
the path in the process's temporary directory
-
getProcTmpTmp
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.getProcTmpTmpDirectory(first, *more)")) final Path getProcTmpTmp(String first, String more)
-
getRandomProcTmpTmpDirectory
final Path getRandomProcTmpTmpDirectory(String prefix, String suffix)
Get a path of the temporary directory in the process's temporary directory.
A typical process temporary directory is:
$env:TMP/pulsar-$env:USERNAME/tmp/- Parameters:
prefix- the prefix of the directory namesuffix- the suffix of the directory name- Returns:
the path in the process's temporary directory
-
getRandomProcTmpTmp
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.getRandomProcTmpTmpDirectory(prefix, suffix)")) final Path getRandomProcTmpTmp(String prefix, String suffix)
-
getContextGroupDir
final Path getContextGroupDir(String group)
-
getContextBaseDir
final Path getContextBaseDir(String group, BrowserType browserType)
-
getTmpContextGroupDir
final Path getTmpContextGroupDir(String group)
-
getTmpContextBaseDir
final Path getTmpContextBaseDir(String group, BrowserType browserType)
-
random
final String random(String prefix, String suffix)
Generates a random string that is compatible with file paths and can be used as a file name. The generated string consists of an optional prefix, a random alphabetic string of 18 characters, and an optional suffix.
- Parameters:
prefix- the prefix of the namesuffix- the suffix of the name- Returns:
the random string
-
hex
final String hex(String uri, String prefix, String suffix)
Generates a path-compatible, hex string that can be used as a file name.
This function takes a URI, hashes it using MD5, and then constructs a string by concatenating the provided prefix, the hashed value, and the provided suffix. The resulting string is suitable for use as a file name.
- Parameters:
uri- The URI to be hashed.prefix- The prefix to be added before the hashed value.suffix- The suffix to be added after the hashed value.- Returns:
A hex string that is the result of concatenating the prefix, the MD5 hash of the URI, and the suffix. This string is suitable for use as a file name.
-
md5Hex
final String md5Hex(String uri)
Generates a path-compatible, hex string that can be used as a file name.
This function takes a URI, hashes it using MD5. The resulting string is suitable for use as a file name.
- Parameters:
uri- The URI to be hashed.- Returns:
A hex string that is the result of concatenating the prefix, the MD5 hash of the URI, and the suffix. This string is suitable for use as a file name.
-
fileId
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "md5Hex(uri)")) final String fileId(String uri)
-
mockPagePath
final Path mockPagePath(String uri)
Create a mock page path.
-
fromDomain
@Deprecated(message = "Use AppPaths.fromHost instead", replaceWith = @ReplaceWith(imports = {}, expression = "AppPaths.fromHost(url)")) final String fromDomain(String url)
-
fromUri
final String fromUri(String uri, String prefix, String suffix)
Create a filename compatible string from the given uri.
-
uniqueSymbolicLinkForUri
final Path uniqueSymbolicLinkForUri(String uri, String suffix)
Create a symbolic link from the given uri.
The symbolic link is url based, unique, shorter but not readable filename
-
getSYS_TMP_DIR
final Path getSYS_TMP_DIR()
-
getSYS_USER_DIR
final Path getSYS_USER_DIR()
-
getSYS_USER_HOME
final Path getSYS_USER_HOME()
-
getSYSTEM_DEFAULT_BROWSER_DATA_DIR_PLACEHOLDER
final Path getSYSTEM_DEFAULT_BROWSER_DATA_DIR_PLACEHOLDER()
The directory for the user's default browser.
The placeholder directory for the user's default browser. This is a placeholder, actually no data dir should be specified, so the browser driver opens a browser just like a normal user opens it. The actual data dir of user's browser are different on different operating systems, for example, on linux, chrome's data dir is: ~/.config/google-chrome/
-
getSYSTEM_DEFAULT_BROWSER_CONTEXT_DIR_PLACEHOLDER
final Path getSYSTEM_DEFAULT_BROWSER_CONTEXT_DIR_PLACEHOLDER()
-
getSYS_TMP_LINKS_DIR
final Path getSYS_TMP_LINKS_DIR()
-
getDATA_DIR
final Path getDATA_DIR()
-
getCONFIG_DIR
final Path getCONFIG_DIR()
-
getBROWSER_DATA_DIR
final Path getBROWSER_DATA_DIR()
-
getCHROME_DATA_DIR_PROTOTYPE
final Path getCHROME_DATA_DIR_PROTOTYPE()
-
getCONTEXT_DEFAULT_DIR
final Path getCONTEXT_DEFAULT_DIR()
-
getLOCAL_DATA_DIR
final Path getLOCAL_DATA_DIR()
-
getLOCAL_STORAGE_DIR
final Path getLOCAL_STORAGE_DIR()
-
getLOCAL_TEST_DATA_DIR
final Path getLOCAL_TEST_DATA_DIR()
-
getLOCAL_TEST_WEB_PAGE_DIR
final Path getLOCAL_TEST_WEB_PAGE_DIR()
-
getTMP_DIR
final Path getTMP_DIR()
-
getPROC_TMP_DIR
final Path getPROC_TMP_DIR()
-
getPROC_TMP_TMP_DIR
final Path getPROC_TMP_TMP_DIR()
-
getCACHE_DIR
final Path getCACHE_DIR()
-
getWEB_CACHE_DIR
final Path getWEB_CACHE_DIR()
-
getDOC_EXPORT_DIR
final Path getDOC_EXPORT_DIR()
-
getWEB_SCREENSHOT_DIR
final Path getWEB_SCREENSHOT_DIR()
-
getFILE_CACHE_DIR
final Path getFILE_CACHE_DIR()
-
getPROMPT_CACHE_DIR
final Path getPROMPT_CACHE_DIR()
-
getREPORT_DIR
final Path getREPORT_DIR()
-
getMETRICS_DIR
final Path getMETRICS_DIR()
-
getSCRIPT_DIR
final Path getSCRIPT_DIR()
-
getTEST_DIR
final Path getTEST_DIR()
-
getCONTEXT_BASE_DIR
final Path getCONTEXT_BASE_DIR()
-
getCONTEXT_GROUP_BASE_DIR
final Path getCONTEXT_GROUP_BASE_DIR()
-
getCONTEXT_DEFAULT_GROUP_DIR
final Path getCONTEXT_DEFAULT_GROUP_DIR()
-
getCONTEXT_TMP_DIR
final Path getCONTEXT_TMP_DIR()
-
getCONTEXT_TMP_GROUP_BASE_DIR
final Path getCONTEXT_TMP_GROUP_BASE_DIR()
-
getCONTEXT_TMP_DEFAULT_GROUP_DIR
final Path getCONTEXT_TMP_DEFAULT_GROUP_DIR()
-
getPROXY_BASE_DIR
final Path getPROXY_BASE_DIR()
Proxy directory
-
getENABLED_PROVIDER_DIR
final Path getENABLED_PROVIDER_DIR()
-
getAVAILABLE_PROVIDER_DIR
final Path getAVAILABLE_PROVIDER_DIR()
-
getENABLED_PROXY_DIR
final Path getENABLED_PROXY_DIR()
-
getAVAILABLE_PROXY_DIR
final Path getAVAILABLE_PROXY_DIR()
-
getPROXY_ARCHIVE_DIR
final Path getPROXY_ARCHIVE_DIR()
-
getPROXY_BANNED_HOSTS_FILE
final Path getPROXY_BANNED_HOSTS_FILE()
-
getPROXY_BANNED_SEGMENTS_FILE
final Path getPROXY_BANNED_SEGMENTS_FILE()
-
getPROXY_BAN_STRATEGY
final Path getPROXY_BAN_STRATEGY()
-
getPATH_LOCAL_COMMAND
final Path getPATH_LOCAL_COMMAND()
-
getPATH_BANNED_URLS
final Path getPATH_BANNED_URLS()
-
getPATH_UNREACHABLE_HOSTS
final Path getPATH_UNREACHABLE_HOSTS()
-
-
-
-