mirror of
https://github.com/thunderbrewhq/bc.git
synced 2025-12-12 10:02:30 +00:00
feat(os): implement OsSetCurrentDirectory and OsGetCurrentDirectory
This commit is contained in:
parent
32f791ac70
commit
90075755b1
4 changed files with 30 additions and 0 deletions
|
|
@ -150,6 +150,18 @@ bool GetWorkingDirectory(char* path, size_t capacity) {
|
|||
return manager->Do(Filesystem::Call::GetWorkingDirectory, &parms);
|
||||
}
|
||||
|
||||
bool SetWorkingDirectory(const char* path) {
|
||||
auto manager = System_File::Stacked::Manager();
|
||||
if (!manager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
System_File::Stacked::FileParms parms = {};
|
||||
parms.filename = path;
|
||||
|
||||
return manager->Do(Filesystem::Call::SetWorkingDirectory, &parms);
|
||||
}
|
||||
|
||||
// Get file information from a stream record, returning a file info pointer owned by StreamRecord
|
||||
// The FileInfo ptr returned is invalidated after a call to File::Close(stream)
|
||||
FileInfo* GetFileInfo(StreamRecord* stream) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ FileInfo* GetFileInfo(StreamRecord* stream);
|
|||
|
||||
bool GetWorkingDirectory(char* path, size_t capacity);
|
||||
|
||||
bool SetWorkingDirectory(const char* path);
|
||||
|
||||
bool MakeAbsolutePath(const char* rel, char* result, int32_t capacity, bool unkflag);
|
||||
|
||||
bool Open(const char* filename, uint32_t flags, StreamRecord*& stream);
|
||||
|
|
|
|||
|
|
@ -146,3 +146,15 @@ int64_t OsSetFilePointer(HOSFILE fileHandle, int64_t distanceToMove, uint32_t mo
|
|||
void OsCloseFile(HOSFILE fileHandle) {
|
||||
Blizzard::File::Close(static_cast<Blizzard::File::StreamRecord*>(fileHandle));
|
||||
}
|
||||
|
||||
int32_t OsSetCurrentDirectory(const char* pathName) {
|
||||
BLIZZARD_ASSERT(pathName);
|
||||
|
||||
return Blizzard::File::SetWorkingDirectory(pathName);
|
||||
}
|
||||
|
||||
int32_t OsGetCurrentDirectory(size_t pathLen, char* pathName) {
|
||||
BLIZZARD_ASSERT(pathName);
|
||||
|
||||
return Blizzard::File::GetWorkingDirectory(pathName, pathLen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,8 @@ void OsCloseFile(HOSFILE fileHandle);
|
|||
|
||||
int64_t OsSetFilePointer(HOSFILE fileHandle, int64_t distanceToMove, uint32_t moveMethod);
|
||||
|
||||
int32_t OsSetCurrentDirectory(const char* pathName);
|
||||
|
||||
int32_t OsGetCurrentDirectory(size_t pathLen, char* pathName);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue