Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform_linux.cpp')
-rw-r--r--platform/platform_linux.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/platform/platform_linux.cpp b/platform/platform_linux.cpp
new file mode 100644
index 0000000000..f3e1065b74
--- /dev/null
+++ b/platform/platform_linux.cpp
@@ -0,0 +1,43 @@
+#include "platform.hpp"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static bool GetUserWritableDir(string & outDir)
+{
+ char * path = ::getenv("HOME");
+ if (path)
+ {
+ outDir = path;
+ outDir += "." LOCALAPPDATA_DIR "/";
+ ::mkdir(outDir.c_str(), 0755);
+ return true;
+ }
+ return false;
+}
+
+/// @return full path including binary itself
+static bool GetPathToBinary(string & outPath)
+{
+ char path[4096] = {0};
+ if (0 < ::readlink("/proc/self/exe", path, ARRAY_SIZE(path)))
+ {
+ outPath = path;
+ return true;
+ }
+ return false;
+}
+
+int Platform::CpuCores() const
+{
+ long numCPU = sysconf(_SC_NPROCESSORS_ONLN);
+ if (numCPU >= 1)
+ return static_cast<int>(numCPU);
+ return 1;
+}
+
+string Platform::UniqueClientId() const
+{
+ return "@TODO";
+}