2017-03-02 09:28:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
2017-03-29 06:33:38 +00:00
|
|
|
#include <vector>
|
2017-03-02 09:28:07 +00:00
|
|
|
|
|
|
|
struct PlatformMutex {
|
2017-03-22 17:03:45 +00:00
|
|
|
virtual ~PlatformMutex();
|
2017-03-02 09:28:07 +00:00
|
|
|
};
|
|
|
|
struct PlatformScopedMutexLock {
|
2017-03-22 17:03:45 +00:00
|
|
|
virtual ~PlatformScopedMutexLock();
|
2017-03-02 09:28:07 +00:00
|
|
|
};
|
|
|
|
struct PlatformSharedMemory {
|
2017-03-22 17:03:45 +00:00
|
|
|
virtual ~PlatformSharedMemory();
|
2017-03-19 22:06:22 +00:00
|
|
|
void* data;
|
|
|
|
size_t capacity;
|
2017-03-15 04:59:05 +00:00
|
|
|
std::string name;
|
2017-03-02 09:28:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<PlatformMutex> CreatePlatformMutex(const std::string& name);
|
2017-03-19 22:08:36 +00:00
|
|
|
std::unique_ptr<PlatformScopedMutexLock> CreatePlatformScopedMutexLock(
|
|
|
|
PlatformMutex* mutex);
|
|
|
|
std::unique_ptr<PlatformSharedMemory> CreatePlatformSharedMemory(
|
|
|
|
const std::string& name,
|
|
|
|
size_t size);
|
2017-03-05 19:48:05 +00:00
|
|
|
|
2017-03-25 20:27:28 +00:00
|
|
|
void PlatformInit();
|
2017-04-18 02:59:48 +00:00
|
|
|
|
2017-03-22 17:03:45 +00:00
|
|
|
std::string GetWorkingDirectory();
|
2017-03-28 01:47:12 +00:00
|
|
|
std::string NormalizePath(const std::string& path);
|
2017-04-18 02:59:48 +00:00
|
|
|
// Creates a directory at |path|. Creates directories recursively if needed.
|
|
|
|
void MakeDirectoryRecursive(std::string path);
|
|
|
|
// Tries to create the directory given by |absolute_path|. Returns true if
|
|
|
|
// successful or if the directory already exists. Returns false otherwise. This
|
|
|
|
// does not attempt to recursively create directories.
|
|
|
|
bool TryMakeDirectory(const std::string& absolute_path);
|
|
|
|
|
2017-04-16 22:48:54 +00:00
|
|
|
void SetCurrentThreadName(const std::string& thread_name);
|
2017-03-29 06:33:38 +00:00
|
|
|
|
2017-04-20 04:57:44 +00:00
|
|
|
int64_t GetLastModificationTime(const std::string& absolute_path);
|
|
|
|
|
2017-03-29 06:33:38 +00:00
|
|
|
// Returns any clang arguments that are specific to the current platform.
|
|
|
|
std::vector<std::string> GetPlatformClangArguments();
|