ICU-3933 Move swapping of file sep char to filetools.h. Update Makefile and project files.

X-SVN-Rev: 25236
This commit is contained in:
Michael Ow 2009-01-12 23:02:36 +00:00
parent d3e13b2291
commit ee00374eee
5 changed files with 23 additions and 15 deletions

View File

@ -50,7 +50,7 @@
#include "pkg_genc.h"
#include "pkg_gencmn.h"
#include "flagparser.h"
#include "filestat.h"
#include "filetools.h"
#if U_HAVE_POPEN
@ -632,9 +632,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
#ifdef WINDOWS_WITH_GNUC
/* Need to fix the file seperator character when using MinGW. */
for (int32_t i = 0, size = uprv_strlen(gencFilePath); i < size; i++) {
gencFilePath[i] = (gencFilePath[i] ==U_FILE_SEP_CHAR ) ? '/' : gencFilePath[i];
}
swapFileSepChar(gencFilePath, U_FILE_SEP_CHAR, '/');
#endif
result = pkg_createWithAssemblyCode(targetDir, mode, gencFilePath);

View File

@ -54,7 +54,7 @@ LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS)
OBJECTS = filestrm.o package.o pkgitems.o swapimpl.o toolutil.o unewdata.o \
ucm.o ucmstate.o uoptions.o uparse.o \
ucbuf.o xmlparser.o writesrc.o \
pkg_icu.o pkg_genc.o pkg_gencmn.o flagparser.o filestat.o
pkg_icu.o pkg_genc.o pkg_gencmn.o flagparser.o filetools.o
STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))

View File

@ -4,7 +4,7 @@
*******************************************************************************
*/
#include "filestat.h"
#include "filetools.h"
#include "filestrm.h"
#include "cstring.h"
#include "unicode/putil.h"
@ -116,3 +116,11 @@ static int32_t whichFileModTimeIsLater(const char *file1, const char *file2) {
return result;
}
/* Swap the file separater character given with the new one in the file path. */
U_CAPI void U_EXPORT2
swapFileSepChar(char *filePath, const char oldFileSepChar, const char newFileSepChar) {
for (int32_t i = 0, length = uprv_strlen(filePath); i < length; i++) {
filePath[i] = (filePath[i] == oldFileSepChar ) ? newFileSepChar : filePath[i];
}
}

View File

@ -5,7 +5,7 @@
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: flagparser.h
* file name: filetools.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@ -13,18 +13,20 @@
* created on: 2009jan09
* created by: Michael Ow
*
* Compares modification times on specified files using ICU and intended for use in ICU tests and in build tools.
* Contains various functions to handle files.
* Not suitable for production use. Not supported.
* Not conformant. Not efficient.
* But very small.
*/
#ifndef __FILESTAT_H__
#define __FILESTAT_H__
#ifndef __FILETOOLS_H__
#define __FILETOOLS_H__
#include "unicode/utypes.h"
U_CAPI UBool U_EXPORT2
isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir=FALSE);
U_CAPI void U_EXPORT2
swapFileSepChar(char *filePath, const char oldFileSepChar, const char newFileSepChar);
#endif

View File

@ -413,11 +413,11 @@
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\filestat.cpp"
RelativePath=".\filestrm.c"
>
</File>
<File
RelativePath=".\filestrm.c"
RelativePath=".\filetools.cpp"
>
</File>
<File
@ -586,11 +586,11 @@
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\filestat.h"
RelativePath=".\filestrm.h"
>
</File>
<File
RelativePath=".\filestrm.h"
RelativePath=".\filetools.h"
>
</File>
<File