From 911cbadd2256cdae7cab6eba74ff97cd115f260d Mon Sep 17 00:00:00 2001 From: Maksymilian Osowski Date: Thu, 12 Aug 2010 17:43:54 +0100 Subject: Added php script in WebKitTools/DumpRenderTree/android/ that fetches all the files under given path. Change-Id: Iac6025007a549833bf8065dacd50f942b1b2f643 --- .../android/get_layout_tests_dir_contents.php | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php (limited to 'WebKitTools/DumpRenderTree') diff --git a/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php b/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php new file mode 100644 index 0000000..84b4ace --- /dev/null +++ b/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php @@ -0,0 +1,98 @@ + $value) { + if (isIgnored($value)) { + continue; + } + if ($relPath == '') { + $filePath = $value; + } else { + $filePath = $relPath . DIRECTORY_SEPARATOR . $value; + } + + if (!is_dir(getAbsolutePath($filePath))) { + $result = array_merge($result, (array)$filePath); + } else if ($recurse) { + $result = array_merge($result, getAllFilesUnderAsArray($filePath, $recurse)); + } + } + + return $result; + } + + $path = getAbsolutePath($_GET['path']); + + if (isset($_GET['separator'])) { + $separator = $_GET['separator']; + } else { + $separator = "\n"; + } + + if (!isset($_GET['recurse'])) { + $_GET['recurse'] = True; + } + + #Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute + if (strpos($_GET['path'], "..") !== False || + substr($_GET['path'], 0, 1) == DIRECTORY_SEPARATOR) { + return; + } + + #If we don't want realpath to append any prefixes we need to pass it an absolute path + $path = realpath(getAbsolutePath($_GET['path'])); + $relPath = substr($path, strlen($rootDir) + 1); + + #If there is an error of some sort it will be output as a part of the answer! + foreach (getAllFilesUnderAsArray($relPath, $_GET['recurse']) as $i => $value) { + echo "$value$separator"; + } +?> -- cgit v1.1