remove mac specific from plaftform
This commit is contained in:
parent
71332527be
commit
54aac65ad7
4 changed files with 1 additions and 82 deletions
|
@ -14,12 +14,6 @@
|
|||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(GEOCORE_OS_MAC)
|
||||
#include <sys/mount.h>
|
||||
#else
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
@ -399,43 +393,6 @@ bool Platform::GetFileSizeByFullPath(string const & filePath, uint64_t & size)
|
|||
else return false;
|
||||
}
|
||||
|
||||
Platform::TStorageStatus Platform::GetWritableStorageStatus(uint64_t neededSize) const
|
||||
{
|
||||
struct statfs st;
|
||||
int const ret = statfs(m_writableDir.c_str(), &st);
|
||||
|
||||
LOG(LDEBUG, ("statfs return =", ret,
|
||||
"; block size =", st.f_bsize,
|
||||
"; blocks available =", st.f_bavail));
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
LOG(LERROR, ("Path:", m_writableDir, "statfs error:", ErrnoToError()));
|
||||
return STORAGE_DISCONNECTED;
|
||||
}
|
||||
|
||||
/// @todo May be add additional storage space.
|
||||
if (st.f_bsize * st.f_bavail < neededSize)
|
||||
return NOT_ENOUGH_SPACE;
|
||||
|
||||
return STORAGE_OK;
|
||||
}
|
||||
|
||||
uint64_t Platform::GetWritableStorageSpace() const
|
||||
{
|
||||
struct statfs st;
|
||||
int const ret = statfs(m_writableDir.c_str(), &st);
|
||||
|
||||
LOG(LDEBUG, ("statfs return =", ret,
|
||||
"; block size =", st.f_bsize,
|
||||
"; blocks available =", st.f_bavail));
|
||||
|
||||
if (ret != 0)
|
||||
LOG(LERROR, ("Path:", m_writableDir, "statfs error:", ErrnoToError()));
|
||||
|
||||
return (ret != 0) ? 0 : st.f_bsize * st.f_bavail;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// Web service ip to check internet connection. Now it's a mail.ru ip.
|
||||
|
|
|
@ -220,19 +220,12 @@ public:
|
|||
STORAGE_DISCONNECTED,
|
||||
NOT_ENOUGH_SPACE
|
||||
};
|
||||
TStorageStatus GetWritableStorageStatus(uint64_t neededSize) const;
|
||||
uint64_t GetWritableStorageSpace() const;
|
||||
|
||||
// Please note, that number of active cores can vary at runtime.
|
||||
// DO NOT assume for the same return value between calls.
|
||||
unsigned CpuCores() const;
|
||||
|
||||
|
||||
|
||||
std::string UniqueClientId() const;
|
||||
|
||||
|
||||
|
||||
/// \brief Placing an executable object |task| on a queue of |thread|. Then the object will be
|
||||
/// executed on |thread|.
|
||||
/// \note |task| cannot be moved in case of |Thread::Gui|. This way unique_ptr cannot be used
|
||||
|
|
|
@ -208,12 +208,6 @@ UNIT_TEST(CpuCores)
|
|||
TEST_LESS_OR_EQUAL(coresNum, 128, ());
|
||||
}
|
||||
|
||||
UNIT_TEST(GetWritableStorageStatus)
|
||||
{
|
||||
TEST_EQUAL(Platform::STORAGE_OK, GetPlatform().GetWritableStorageStatus(100000), ());
|
||||
TEST_EQUAL(Platform::NOT_ENOUGH_SPACE, GetPlatform().GetWritableStorageStatus(uint64_t(-1)), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(RmDirRecursively)
|
||||
{
|
||||
std::string const testDir1 = base::JoinPath(GetPlatform().WritableDir(), "test_dir1");
|
||||
|
|
|
@ -3,15 +3,7 @@
|
|||
#include "base/logging.hpp"
|
||||
#include "base/macros.hpp"
|
||||
|
||||
#include "platform/target_os.hpp"
|
||||
|
||||
#if defined(GEOCORE_OS_MAC)
|
||||
#include <CoreFoundation/CFLocale.h>
|
||||
#include <CoreFoundation/CFString.h>
|
||||
#elif defined(GEOCORE_OS_LINUX)
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
@ -22,7 +14,6 @@ namespace languages
|
|||
|
||||
void GetSystemPreferred(vector<string> & languages)
|
||||
{
|
||||
#if defined(GEOCORE_OS_MAC) || defined(GEOCORE_OS_LINUX)
|
||||
// check environment variables
|
||||
char const * p = getenv("LANGUAGE");
|
||||
if (p && strlen(p)) // LANGUAGE can contain several values divided by ':'
|
||||
|
@ -38,22 +29,6 @@ void GetSystemPreferred(vector<string> & languages)
|
|||
languages.push_back(p);
|
||||
else if ((p = getenv("LANG")))
|
||||
languages.push_back(p);
|
||||
#if defined(GEOCORE_OS_MAC)
|
||||
else
|
||||
{
|
||||
// Mac and iOS implementation
|
||||
CFArrayRef langs = CFLocaleCopyPreferredLanguages();
|
||||
char buf[30];
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(langs); ++i)
|
||||
{
|
||||
CFStringRef strRef = (CFStringRef)CFArrayGetValueAtIndex(langs, i);
|
||||
CFStringGetCString(strRef, buf, 30, kCFStringEncodingUTF8);
|
||||
languages.push_back(buf);
|
||||
}
|
||||
CFRelease(langs);
|
||||
}
|
||||
#endif // defined(GEOCORE_OS_MAC)
|
||||
#endif // defined(GEOCORE_OS_MAC) || defined(GEOCORE_OS_LINUX)
|
||||
}
|
||||
|
||||
string GetPreferred()
|
||||
|
|
Loading…
Add table
Reference in a new issue