free(pathname);
assert(result.isValid() && "tempnam didn't create a valid pathname!");
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;
}
free(pathname);
assert(result.isValid() && "tempnam didn't create a valid pathname!");
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;
}
if (info_->hFile == INVALID_HANDLE_VALUE) {
delete info_;
info_ = NULL;
- ThrowError(std::string("Can't open file: ") + path_.get());
+ ThrowError(std::string("Can't open file: ") + path_.toString());
}
LARGE_INTEGER size;
CloseHandle(info_->hFile);
delete info_;
info_ = NULL;
- ThrowError(std::string("Can't get size of file: ") + path_.get());
+ ThrowError(std::string("Can't get size of file: ") + path_.toString());
}
}
prot = PAGE_READWRITE;
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, 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;
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
if (base_ == NULL) {
CloseHandle(info_->hMapping);
info_->hMapping = NULL;
- ThrowError(std::string("Can't map file: ") + path_.get());
+ ThrowError(std::string("Can't map file: ") + path_.toString());
}
}
return base_;
LARGE_INTEGER eof;
eof.QuadPart = new_size;
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))
- 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;
}
if (info_->hFile == INVALID_HANDLE_VALUE) {
delete info_;
info_ = NULL;
- ThrowError(std::string("Can't open file: ") + path_.get());
+ ThrowError(std::string("Can't open file: ") + path_.toString());
}
LARGE_INTEGER size;
CloseHandle(info_->hFile);
delete info_;
info_ = NULL;
- ThrowError(std::string("Can't get size of file: ") + path_.get());
+ ThrowError(std::string("Can't get size of file: ") + path_.toString());
}
}
prot = PAGE_READWRITE;
info_->hMapping = CreateFileMapping(info_->hFile, NULL, prot, 0, 0, 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;
base_ = MapViewOfFileEx(info_->hMapping, prot, 0, 0, 0, NULL);
if (base_ == NULL) {
CloseHandle(info_->hMapping);
info_->hMapping = NULL;
- ThrowError(std::string("Can't map file: ") + path_.get());
+ ThrowError(std::string("Can't map file: ") + path_.toString());
}
}
return base_;
LARGE_INTEGER eof;
eof.QuadPart = new_size;
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))
- 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;
}
Program::ExecuteAndWait(const Path& path,
const std::vector<std::string>& args) {
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
// process. We have to concatenate them all, while quoting the args that
PROCESS_INFORMATION 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))
{
- ThrowError(std::string("Couldn't execute program '") + path.get() + "'");
+ ThrowError(std::string("Couldn't execute program '") +
+ path.toString() + "'");
}
// Wait for it to terminate.
CloseHandle(pi.hThread);
if (!rc)
- ThrowError(std::string("Failed getting status for program '") + path.get() + "'");
+ ThrowError(std::string("Failed getting status for program '") +
+ path.toString() + "'");
return status;
}
Program::ExecuteAndWait(const Path& path,
const std::vector<std::string>& args) {
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
// process. We have to concatenate them all, while quoting the args that
PROCESS_INFORMATION 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))
{
- ThrowError(std::string("Couldn't execute program '") + path.get() + "'");
+ ThrowError(std::string("Couldn't execute program '") +
+ path.toString() + "'");
}
// Wait for it to terminate.
CloseHandle(pi.hThread);
if (!rc)
- ThrowError(std::string("Failed getting status for program '") + path.get() + "'");
+ ThrowError(std::string("Failed getting status for program '") +
+ path.toString() + "'");
return status;
}