diff --git a/.gitignore b/.gitignore index de92a1b8fc..2a43cd201a 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,5 @@ CheckIfConfigurationRestoresMCCFilterGain.json # Renamed experiments during tests Packages/tests/**/20*.pxp + +Packages/tests/Basic/test* diff --git a/Packages/MIES/MIES_Utilities.ipf b/Packages/MIES/MIES_Utilities.ipf index 307cdb7555..f8e2e26370 100644 --- a/Packages/MIES/MIES_Utilities.ipf +++ b/Packages/MIES/MIES_Utilities.ipf @@ -2867,7 +2867,7 @@ Function/S GetAllFilesRecursivelyFromPath(pathName, [extension]) KillPath/Z $subFolderPathName if(!isEmpty(files)) - allFiles = AddListItem(files, allFiles, FILE_LIST_SEP, Inf) + allFiles = AddListItem(RemoveEnding(files, FILE_LIST_SEP), allFiles, FILE_LIST_SEP, Inf) endif endfor diff --git a/Packages/tests/Basic/UTF_Utils.ipf b/Packages/tests/Basic/UTF_Utils.ipf index b0fcfec2d2..d54eef2d45 100644 --- a/Packages/tests/Basic/UTF_Utils.ipf +++ b/Packages/tests/Basic/UTF_Utils.ipf @@ -7202,3 +7202,38 @@ static Function TestUpperCaseFirstChar() CHECK_EQUAL_STR(UpperCaseFirstChar("a1a"), "A1a") CHECK_EQUAL_STR(UpperCaseFirstChar("b"), "B") End + +static Function TestGetAllFilesRecursivelyFromPath() + + string folder, symbPath, list + + folder = GetFolder(FunctionPath("")) + "testFolder:" + + symbPath = GetUniqueSymbolicPath() + NewPath/Q/O/C/Z $symbPath, folder + CHECK(!V_Flag) + + CreateFolderOnDisk(folder + "b:") + CreateFolderOnDisk(folder + "c:") + + SaveTextFile("", folder + "file.txt") + SaveTextFile("", folder + "b:file1.txt") + SaveTextFile("", folder + "c:file2.txt") + + CreateAliasShortcut/Z/P=$symbPath "file.txt" "alias.txt" + CHECK(!V_flag) + + list = GetAllFilesRecursivelyFromPath(symbPath, extension = ".txt") + CHECK_PROPER_STR(list) + + WAVE/T result = ListToTextWave(list, FILE_LIST_SEP) + result[] = RemovePrefix(result[p], start = folder) + CHECK_EQUAL_TEXTWAVES(result, {"file.txt", "b:file1.txt", "c:file2.txt"}) + + // no matches + list = GetAllFilesRecursivelyFromPath(symbPath, extension = ".abc") + CHECK_EMPTY_STR(list) + + KillPath $symbPath + CHECK_NO_RTE() +End