You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/03/01 06:23:47 UTC
[lucy-commits] svn commit: r1075666 - in /incubator/lucy/trunk/clownfish: src/CFCFile.c
t/403-file.t
Author: marvin
Date: Tue Mar 1 05:23:47 2011
New Revision: 1075666
URL: http://svn.apache.org/viewvc?rev=1075666&view=rev
Log:
Fix path handling by CFCFile under Windows.
Modified:
incubator/lucy/trunk/clownfish/src/CFCFile.c
incubator/lucy/trunk/clownfish/t/403-file.t
Modified: incubator/lucy/trunk/clownfish/src/CFCFile.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCFile.c?rev=1075666&r1=1075665&r2=1075666&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCFile.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCFile.c Tue Mar 1 05:23:47 2011
@@ -191,6 +191,14 @@ S_some_path(CFCFile *self, char *buf, si
int check = sprintf(buf, "%s%s", self->path_part, ext);
if (check < 0) { croak("sprintf failed"); }
}
+ size_t i;
+ for (i = 0; buf[i] != '\0'; i++) {
+ #ifdef _WIN32
+ if (buf[i] == '/') { buf[i] = '\\'; }
+ #else
+ if (buf[i] == '\\') { buf[i] = '/'; }
+ #endif
+ }
}
size_t
Modified: incubator/lucy/trunk/clownfish/t/403-file.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/t/403-file.t?rev=1075666&r1=1075665&r2=1075666&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/t/403-file.t (original)
+++ incubator/lucy/trunk/clownfish/t/403-file.t Tue Mar 1 05:23:47 2011
@@ -47,9 +47,11 @@ ok( !$file->get_modified, "modified fals
$file->set_modified(1);
ok( $file->get_modified, "set_modified, get_modified" );
-is( $file->cfh_path('/path/to'), "/path/to/Stuff/Thing.cfh", "cfh_path" );
-is( $file->c_path('/path/to'), "/path/to/Stuff/Thing.c", "c_path" );
-is( $file->h_path('/path/to'), "/path/to/Stuff/Thing.h", "h_path" );
+my $path_sep = $^O =~ /win/i ? '\\' : '/';
+my $path_to_stuff_thing = join($path_sep, qw( path to Stuff Thing ) );
+is( $file->cfh_path('path/to'), "$path_to_stuff_thing.cfh", "cfh_path" );
+is( $file->c_path('path/to'), "$path_to_stuff_thing.c", "c_path" );
+is( $file->h_path('path/to'), "$path_to_stuff_thing.h", "h_path" );
my $classes = $file->classes;
is( scalar @$classes, 1, "classes() filters blocks" );