gjs r69 - in trunk: . gjs test/js test/js/modules/subA test/js/modules/subA/.hidden
- From: tko svn gnome org
- To: svn-commits-list gnome org
- Subject: gjs r69 - in trunk: . gjs test/js test/js/modules/subA test/js/modules/subA/.hidden
- Date: Mon, 3 Nov 2008 13:37:33 +0000 (UTC)
Author: tko
Date: Mon Nov 3 13:37:33 2008
New Revision: 69
URL: http://svn.gnome.org/viewvc/gjs?rev=69&view=rev
Log:
Bug 559075 â enumerating importer should skip hidden files
* gjs/importer.c (importer_new_enumerate): skip hidden files and
directories (.svn, .git, ..)
* Makefile-test.am:
* test/js/modules/subA/.hidden/hidden.js:
* test/js/modules/subA/.secret.js:
* test/js/testImporter.js (testImporterEnumerateSkipHidden,
testImporterHidden): add test
Added:
trunk/test/js/modules/subA/.hidden/
trunk/test/js/modules/subA/.hidden/hidden.js
trunk/test/js/modules/subA/.secret.js
Modified:
trunk/Makefile-test.am
trunk/gjs/importer.c
trunk/test/js/testImporter.js
Modified: trunk/Makefile-test.am
==============================================================================
--- trunk/Makefile-test.am (original)
+++ trunk/Makefile-test.am Mon Nov 3 13:37:33 2008
@@ -96,6 +96,8 @@
test/js/modules/jsUnit.js \
test/js/modules/alwaysThrows.js \
test/js/modules/foobar.js \
+ test/js/modules/subA/.secret.js \
+ test/js/modules/subA/.hidden/hidden.js \
test/js/modules/subA/foo \
test/js/modules/subA/subB/foobar.js \
test/js/modules/subA/subB/baz.js \
Modified: trunk/gjs/importer.c
==============================================================================
--- trunk/gjs/importer.c (original)
+++ trunk/gjs/importer.c Mon Nov 3 13:37:33 2008
@@ -566,7 +566,13 @@
}
while ((filename = g_dir_read_name(dir))) {
- char *full_path = g_build_filename(dirname, filename, NULL);
+ char *full_path;
+
+ /* skip hidden files and directories (.svn, .git, ...) */
+ if (filename[0] == '.')
+ continue;
+
+ full_path = g_build_filename(dirname, filename, NULL);
if (g_file_test(full_path, G_FILE_TEST_IS_DIR)) {
g_ptr_array_add(iter->elements, g_strdup(filename));
Added: trunk/test/js/modules/subA/.hidden/hidden.js
==============================================================================
Added: trunk/test/js/modules/subA/.secret.js
==============================================================================
Modified: trunk/test/js/testImporter.js
==============================================================================
--- trunk/test/js/testImporter.js (original)
+++ trunk/test/js/testImporter.js Mon Nov 3 13:37:33 2008
@@ -71,4 +71,18 @@
}
+function testImporterEnumerateSkipHidden() {
+ const subA = imports.subA;
+
+ for (let module in subA) {
+ assertTrue("hidden module '"+module+"' should not be seen", module[0] != '.');
+ }
+}
+
+function testImporterHidden() {
+ // mainly for distcheck, really
+ const secret = imports.subA['.secret'];
+ const hidden = imports.subA['.hidden'].hidden;
+}
+
gjstestRun();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]