mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
Rename Path::get -> Path::toString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -43,7 +43,7 @@ Path::GetTemporaryDirectory() {
|
|||||||
free(pathname);
|
free(pathname);
|
||||||
assert(result.isValid() && "tempnam didn't create a valid pathname!");
|
assert(result.isValid() && "tempnam didn't create a valid pathname!");
|
||||||
if (0 != mkdir(result.c_str(), S_IRWXU))
|
if (0 != mkdir(result.c_str(), S_IRWXU))
|
||||||
ThrowErrno(result.get() + ": Can't create temporary directory");
|
ThrowErrno(result.toString() + ": Can't create temporary directory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Path::GetTemporaryDirectory() {
|
|||||||
free(pathname);
|
free(pathname);
|
||||||
assert(result.isValid() && "tempnam didn't create a valid pathname!");
|
assert(result.isValid() && "tempnam didn't create a valid pathname!");
|
||||||
if (0 != mkdir(result.c_str(), S_IRWXU))
|
if (0 != mkdir(result.c_str(), S_IRWXU))
|
||||||
ThrowErrno(result.get() + ": Can't create temporary directory");
|
ThrowErrno(result.toString() + ": Can't create temporary directory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void MappedFile::initialize() {
|
|||||||
if (info_->hFile == INVALID_HANDLE_VALUE) {
|
if (info_->hFile == INVALID_HANDLE_VALUE) {
|
||||||
delete info_;
|
delete info_;
|
||||||
info_ = NULL;
|
info_ = NULL;
|
||||||
ThrowError(std::string("Can't open file: ") + path_.get());
|
ThrowError(std::string("Can't open file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
LARGE_INTEGER size;
|
LARGE_INTEGER size;
|
||||||
@ -51,7 +51,7 @@ void MappedFile::initialize() {
|
|||||||
CloseHandle(info_->hFile);
|
CloseHandle(info_->hFile);
|
||||||
delete info_;
|
delete info_;
|
||||||
info_ = NULL;
|
info_ = NULL;
|
||||||
ThrowError(std::string("Can't get size of file: ") + path_.get());
|
ThrowError(std::string("Can't get size of file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,14 +84,14 @@ void* MappedFile::map() {
|
|||||||
prot = PAGE_READWRITE;
|
prot = PAGE_READWRITE;
|
||||||
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, NULL);
|
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, NULL);
|
||||||
if (info_->hMapping == NULL)
|
if (info_->hMapping == NULL)
|
||||||
ThrowError(std::string("Can't map file: ") + path_.get());
|
ThrowError(std::string("Can't map file: ") + path_.toString());
|
||||||
|
|
||||||
prot = (options_ & WRITE_ACCESS) ? FILE_MAP_WRITE : FILE_MAP_READ;
|
prot = (options_ & WRITE_ACCESS) ? FILE_MAP_WRITE : FILE_MAP_READ;
|
||||||
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
|
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
|
||||||
if (base_ == NULL) {
|
if (base_ == NULL) {
|
||||||
CloseHandle(info_->hMapping);
|
CloseHandle(info_->hMapping);
|
||||||
info_->hMapping = NULL;
|
info_->hMapping = NULL;
|
||||||
ThrowError(std::string("Can't map file: ") + path_.get());
|
ThrowError(std::string("Can't map file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return base_;
|
return base_;
|
||||||
@ -117,9 +117,9 @@ void MappedFile::size(size_t new_size) {
|
|||||||
LARGE_INTEGER eof;
|
LARGE_INTEGER eof;
|
||||||
eof.QuadPart = new_size;
|
eof.QuadPart = new_size;
|
||||||
if (!SetFilePointerEx(info_->hFile, eof, NULL, FILE_BEGIN))
|
if (!SetFilePointerEx(info_->hFile, eof, NULL, FILE_BEGIN))
|
||||||
ThrowError(std::string("Can't set end of file: ") + path_.get());
|
ThrowError(std::string("Can't set end of file: ") + path_.toString());
|
||||||
if (!SetEndOfFile(info_->hFile))
|
if (!SetEndOfFile(info_->hFile))
|
||||||
ThrowError(std::string("Can't set end of file: ") + path_.get());
|
ThrowError(std::string("Can't set end of file: ") + path_.toString());
|
||||||
info_->size = new_size;
|
info_->size = new_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void MappedFile::initialize() {
|
|||||||
if (info_->hFile == INVALID_HANDLE_VALUE) {
|
if (info_->hFile == INVALID_HANDLE_VALUE) {
|
||||||
delete info_;
|
delete info_;
|
||||||
info_ = NULL;
|
info_ = NULL;
|
||||||
ThrowError(std::string("Can't open file: ") + path_.get());
|
ThrowError(std::string("Can't open file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
LARGE_INTEGER size;
|
LARGE_INTEGER size;
|
||||||
@ -51,7 +51,7 @@ void MappedFile::initialize() {
|
|||||||
CloseHandle(info_->hFile);
|
CloseHandle(info_->hFile);
|
||||||
delete info_;
|
delete info_;
|
||||||
info_ = NULL;
|
info_ = NULL;
|
||||||
ThrowError(std::string("Can't get size of file: ") + path_.get());
|
ThrowError(std::string("Can't get size of file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,14 +84,14 @@ void* MappedFile::map() {
|
|||||||
prot = PAGE_READWRITE;
|
prot = PAGE_READWRITE;
|
||||||
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, NULL);
|
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, NULL);
|
||||||
if (info_->hMapping == NULL)
|
if (info_->hMapping == NULL)
|
||||||
ThrowError(std::string("Can't map file: ") + path_.get());
|
ThrowError(std::string("Can't map file: ") + path_.toString());
|
||||||
|
|
||||||
prot = (options_ & WRITE_ACCESS) ? FILE_MAP_WRITE : FILE_MAP_READ;
|
prot = (options_ & WRITE_ACCESS) ? FILE_MAP_WRITE : FILE_MAP_READ;
|
||||||
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
|
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
|
||||||
if (base_ == NULL) {
|
if (base_ == NULL) {
|
||||||
CloseHandle(info_->hMapping);
|
CloseHandle(info_->hMapping);
|
||||||
info_->hMapping = NULL;
|
info_->hMapping = NULL;
|
||||||
ThrowError(std::string("Can't map file: ") + path_.get());
|
ThrowError(std::string("Can't map file: ") + path_.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return base_;
|
return base_;
|
||||||
@ -117,9 +117,9 @@ void MappedFile::size(size_t new_size) {
|
|||||||
LARGE_INTEGER eof;
|
LARGE_INTEGER eof;
|
||||||
eof.QuadPart = new_size;
|
eof.QuadPart = new_size;
|
||||||
if (!SetFilePointerEx(info_->hFile, eof, NULL, FILE_BEGIN))
|
if (!SetFilePointerEx(info_->hFile, eof, NULL, FILE_BEGIN))
|
||||||
ThrowError(std::string("Can't set end of file: ") + path_.get());
|
ThrowError(std::string("Can't set end of file: ") + path_.toString());
|
||||||
if (!SetEndOfFile(info_->hFile))
|
if (!SetEndOfFile(info_->hFile))
|
||||||
ThrowError(std::string("Can't set end of file: ") + path_.get());
|
ThrowError(std::string("Can't set end of file: ") + path_.toString());
|
||||||
info_->size = new_size;
|
info_->size = new_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ int
|
|||||||
Program::ExecuteAndWait(const Path& path,
|
Program::ExecuteAndWait(const Path& path,
|
||||||
const std::vector<std::string>& args) {
|
const std::vector<std::string>& args) {
|
||||||
if (!path.executable())
|
if (!path.executable())
|
||||||
throw path.get() + " is not executable";
|
throw path.toString() + " is not executable";
|
||||||
|
|
||||||
// Windows wants a command line, not an array of args, to pass to the new
|
// Windows wants a command line, not an array of args, to pass to the new
|
||||||
// process. We have to concatenate them all, while quoting the args that
|
// process. We have to concatenate them all, while quoting the args that
|
||||||
@ -124,10 +124,11 @@ Program::ExecuteAndWait(const Path& path,
|
|||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&pi, 0, sizeof(pi));
|
||||||
|
|
||||||
if (!CreateProcess(path.get().c_str(), command, NULL, NULL, FALSE, 0,
|
if (!CreateProcess(path.c_str(), command, NULL, NULL, FALSE, 0,
|
||||||
NULL, NULL, &si, &pi))
|
NULL, NULL, &si, &pi))
|
||||||
{
|
{
|
||||||
ThrowError(std::string("Couldn't execute program '") + path.get() + "'");
|
ThrowError(std::string("Couldn't execute program '") +
|
||||||
|
path.toString() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for it to terminate.
|
// Wait for it to terminate.
|
||||||
@ -142,7 +143,8 @@ Program::ExecuteAndWait(const Path& path,
|
|||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
|
|
||||||
if (!rc)
|
if (!rc)
|
||||||
ThrowError(std::string("Failed getting status for program '") + path.get() + "'");
|
ThrowError(std::string("Failed getting status for program '") +
|
||||||
|
path.toString() + "'");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ int
|
|||||||
Program::ExecuteAndWait(const Path& path,
|
Program::ExecuteAndWait(const Path& path,
|
||||||
const std::vector<std::string>& args) {
|
const std::vector<std::string>& args) {
|
||||||
if (!path.executable())
|
if (!path.executable())
|
||||||
throw path.get() + " is not executable";
|
throw path.toString() + " is not executable";
|
||||||
|
|
||||||
// Windows wants a command line, not an array of args, to pass to the new
|
// Windows wants a command line, not an array of args, to pass to the new
|
||||||
// process. We have to concatenate them all, while quoting the args that
|
// process. We have to concatenate them all, while quoting the args that
|
||||||
@ -124,10 +124,11 @@ Program::ExecuteAndWait(const Path& path,
|
|||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&pi, 0, sizeof(pi));
|
||||||
|
|
||||||
if (!CreateProcess(path.get().c_str(), command, NULL, NULL, FALSE, 0,
|
if (!CreateProcess(path.c_str(), command, NULL, NULL, FALSE, 0,
|
||||||
NULL, NULL, &si, &pi))
|
NULL, NULL, &si, &pi))
|
||||||
{
|
{
|
||||||
ThrowError(std::string("Couldn't execute program '") + path.get() + "'");
|
ThrowError(std::string("Couldn't execute program '") +
|
||||||
|
path.toString() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for it to terminate.
|
// Wait for it to terminate.
|
||||||
@ -142,7 +143,8 @@ Program::ExecuteAndWait(const Path& path,
|
|||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
|
|
||||||
if (!rc)
|
if (!rc)
|
||||||
ThrowError(std::string("Failed getting status for program '") + path.get() + "'");
|
ThrowError(std::string("Failed getting status for program '") +
|
||||||
|
path.toString() + "'");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user