version 1.55, 2005/02/06 21:13:14
|
version 1.63, 2006/01/30 16:17:04
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
} | } |
| |
void FileSystem::loadFileToMemory( | void FileSystem::loadFileToMemory( |
Array<char>& array, |
Buffer& array, |
const String& fileName) | const String& fileName) |
{ | { |
Uint32 fileSize; | Uint32 fileSize; |
|
|
size_t n; | size_t n; |
| |
while ((n = fread(buffer, 1, sizeof(buffer), fp)) > 0) | while ((n = fread(buffer, 1, sizeof(buffer), fp)) > 0) |
array.append(buffer, n); |
array.append(buffer, static_cast<Uint32>(n)); |
| |
fclose(fp); | fclose(fp); |
} | } |
|
|
String path = String::EMPTY; | String path = String::EMPTY; |
String root = String::EMPTY; | String root = String::EMPTY; |
String tempPath = paths; | String tempPath = paths; |
|
|
|
|
do { | do { |
if (( pos = tempPath.find(FileSystem::getPathDelimiter())) == PEG_NOT_FOUND) { | if (( pos = tempPath.find(FileSystem::getPathDelimiter())) == PEG_NOT_FOUND) { |
pos = tempPath.size(); | pos = tempPath.size(); |
|
|
path = tempPath.subString(0, pos); | path = tempPath.subString(0, pos); |
tempPath.remove(0,pos+token); | tempPath.remove(0,pos+token); |
if (FileSystem::exists( path + "/" + filename) == true) { | if (FileSystem::exists( path + "/" + filename) == true) { |
#if defined(PEGASUS_OS_VMS) |
|
root = filename; |
|
#else |
|
root = path + "/" + filename; | root = path + "/" + filename; |
#endif |
|
break; | break; |
} else | } else |
{ | { |
// cout << "File does not exist.\n"; | // cout << "File does not exist.\n"; |
} | } |
} while (tempPath.size() > 0); | } while (tempPath.size() > 0); |
|
|
return root; | return root; |
} | } |
| |
|
|
// Add the necessary prefix and suffix to convert the library name to its | // Add the necessary prefix and suffix to convert the library name to its |
// corresponding file name. | // corresponding file name. |
// | // |
#if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
fileName = libraryName + String(".dll"); | fileName = libraryName + String(".dll"); |
#elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) | #elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
fileName = String("lib") + libraryName + String(".sl"); | fileName = String("lib") + libraryName + String(".sl"); |
|
|
line.clear(); | line.clear(); |
| |
Boolean gotChar = false; | Boolean gotChar = false; |
|
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM |
|
char input[1000]; |
|
is.getline(input,1000); |
|
line.assign(input); |
|
|
|
gotChar = !(is.rdstate() & PEGASUS_STD(istream)::failbit); |
|
#else |
char c; | char c; |
| |
while (is.get(c)) | while (is.get(c)) |
|
|
| |
line.append(c); | line.append(c); |
} | } |
|
#endif |
| |
return gotChar; | return gotChar; |
} | } |