From addffa169b8782e07a6c8fcaec42233114c85543 Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Mon, 25 Jul 2022 22:04:34 +0200 Subject: Document the new method Normalize in SF FileSystem Change-Id: If991bff08656c3de0616e2914c8cc31979c4c445 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/137417 Tested-by: Jenkins Reviewed-by: Alain Romedenne --- source/text/sbasic/shared/03/sf_filesystem.xhp | 41 ++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'source/text') diff --git a/source/text/sbasic/shared/03/sf_filesystem.xhp b/source/text/sbasic/shared/03/sf_filesystem.xhp index 0072c8290d..d331ba8a7b 100644 --- a/source/text/sbasic/shared/03/sf_filesystem.xhp +++ b/source/text/sbasic/shared/03/sf_filesystem.xhp @@ -318,10 +318,11 @@ HashFile
MoveFile
MoveFolder
+ Normalize
OpenTextFile
PickFile
PickFolder
- SubFolders

+ SubFolders
@@ -587,7 +588,7 @@

ExtensionFolder

Returns a string containing the folder where the specified extension package is installed. - The current value of the property SF_FileSystem.FileNaming is used to determine the notation of the returned string. + The current value of the property SF_FileSystem.FileNaming is used to determine the notation of the returned string. Use the property Extensions from the Platform service to get string array with the IDs of all installed extensions. @@ -979,6 +980,42 @@ +
+ Normalize --------------------------------------------------------------------------------------------- + + FileSystem service;Normalize + +

Normalize

+ Returns a string containing the normalized pathn ame by collapsing redundant separators and up-level references. + For instance, the path names A//B, A/B/, A/./B and A/foo/../B are all normalized to A/B. + On Windows, forward slashes "/" are converted to backward slashes "\". + The current value of the property SF_FileSystem.FileNaming is used to determine the notation of the filename argument as well as the format of the returned string. + + + svc.Normalize(filename: str): str + + + filename: a string representing a valid path name. The file or directory represented by this argument may not exist. + + + + FSO.FileNaming = "URL" + ' file:///home/user/Documents + normPath = FSO.Normalize("file:///home/user/Documents/") + ' file:///home/user/Documents + normPath = FSO.Normalize("file:///home//user//Documents/") + ' file:///home/user + normPath = FSO.Normalize("file:///home//user//Documents/../") + + + + fs.FileNaming = "URL" + normPath = fs.Normalize("file:///home/user/Documents/") + normPath = fs.Normalize("file:///home//user//Documents/") + normPath = fs.Normalize("file:///home//user//Documents/../") + +
+
OpenTextFile ----------------------------------------------------------------------------------------- -- cgit