compatibility fixes

svn path=/branches/xmlbuildsystem/; revision=13401
This commit is contained in:
Royce Mitchell III 2005-02-03 23:54:02 +00:00
parent cb6d12288b
commit 2212e07d3e
5 changed files with 23 additions and 19 deletions

View file

@ -2,12 +2,16 @@
#include "pch.h"
#ifdef _MSC_VER
#define MAX_PATH _MAX_PATH
#endif
#ifdef WIN32
# include <direct.h>
# include <io.h>
#else
# include <sys/stat.h>
#define _MAX_PATH 255
# define MAX_PATH PATH_MAX
#endif
#include <assert.h>
@ -180,16 +184,10 @@ Path::RelativeFromWorkingDirectory ( const string& path )
vout.push_back ( vpath[i++] );
// now merge vout into a string again
string out;
string out = ".";
for ( i = 0; i < vout.size(); i++ )
{
// this squirreliness is b/c win32 has drive letters and *nix doesn't...
#ifdef WIN32
if ( i ) out += "/";
#else
out += out.size() ? "/" : "./";
#endif
out += vout[i];
out += "/" + vout[i];
}
return out;
}

View file

@ -14,6 +14,10 @@
#include <stdarg.h>
#ifdef _MSC_VER
#define MAX_PATH _MAX_PATH
#endif
#ifndef WIN32
#include <wctype.h>
#include <math.h>

View file

@ -6,12 +6,14 @@
#ifdef WIN32
#include <direct.h>
#include <io.h>
#else
#define _MAX_PATH 255
#endif
#include <sys/stat.h>
#include <time.h>
#ifdef _MSC_VER
#include <sys/utime.h>
#else
#include <utime.h>
#endif
#include "ssprintf.h"
#include "exception.h"

View file

@ -5,5 +5,5 @@ using std::string;
void FunctionTest::Run ()
{
string fixedupFilename = FixupTargetFilename ( "." SSEP "dir1" SSEP "dir2" SSEP ".." SSEP "filename.txt" );
ARE_EQUAL ( "$(ROS_INTERMEDIATE)dir1" SSEP "filename.txt", fixedupFilename );
ARE_EQUAL ( "$(ROS_INTERMEDIATE)." SSEP "dir1" SSEP "filename.txt", fixedupFilename );
}

View file

@ -38,9 +38,9 @@ SourceFileTest::IncludeTest ()
AutomaticDependency automaticDependency ( project );
automaticDependency.Process ();
ARE_EQUAL( 4, automaticDependency.sourcefile_map.size () );
const SourceFile* include = automaticDependency.RetrieveFromCache ( "tests" SSEP "data" SSEP "sourcefile_include.h" );
const SourceFile* include = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile_include.h" );
IS_NOT_NULL( include );
const SourceFile* includenext = automaticDependency.RetrieveFromCache ( "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
const SourceFile* includenext = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );
IS_NOT_NULL( includenext );
}
@ -51,9 +51,9 @@ SourceFileTest::FullParseTest ()
AutomaticDependency automaticDependency ( project );
automaticDependency.Process ();
ARE_EQUAL( 5, automaticDependency.sourcefile_map.size () );
const SourceFile* header1 = automaticDependency.RetrieveFromCache ( "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
const SourceFile* header1 = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1_header1.h" );
IS_NOT_NULL( header1 );
const SourceFile* recurse = automaticDependency.RetrieveFromCache ( "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
const SourceFile* recurse = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );
IS_NOT_NULL( recurse );
IS_TRUE( IsParentOf ( header1,
recurse ) );