androidplatform.cpp

main 160 lines · 3.3 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1/*
2 * Copyright (c) 2010-2016 OTClient <https://github.com/edubart/otclient>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#ifdef ANDROID
24
25#include <framework/global.h>
26
27#include "platform.h"
28#include "androidwindow.h"
29#include <fstream>
30#include <unistd.h>
31#include <string.h>
32#include <framework/stdext/stdext.h>
33#include <framework/core/eventdispatcher.h>
34
35#include <sys/stat.h>
36
37void Platform::processArgs(std::vector<std::string>& args)
38{
39 //nothing todo, linux args are already utf8 encoded
40}
41
42bool Platform::spawnProcess(std::string process, const std::vector<std::string>& args)
43{
44 return false;
45}
46
47int Platform::getProcessId()
48{
49 return getpid();
50}
51
52bool Platform::isProcessRunning(const std::string& name)
53{
54 return false;
55}
56
57bool Platform::killProcess(const std::string& name)
58{
59 return false;
60}
61
62std::string Platform::getTempPath()
63{
64 return "/tmp/";
65}
66
67std::string Platform::getCurrentDir()
68{
69 std::string res;
70 char cwd[2048];
71 if (getcwd(cwd, sizeof(cwd)) != NULL) {
72 res = cwd;
73 res += "/";
74 }
75 return res;
76}
77
78bool Platform::copyFile(std::string from, std::string to)
79{
80 return true;
81}
82
83bool Platform::fileExists(std::string file)
84{
85 return true;
86}
87
88bool Platform::removeFile(std::string file)
89{
90 return false;
91}
92
93ticks_t Platform::getFileModificationTime(std::string file)
94{
95 return 0;
96}
97
98bool Platform::openUrl(std::string url, bool now)
99{
100 g_graphicsDispatcher.addEvent(std::bind(&AndroidWindow::openUrl, g_androidWindow, url));
101 return true;
102}
103
104bool Platform::openDir(std::string path, bool now)
105{
106 return true;
107}
108
109std::string Platform::getCPUName()
110{
111 return std::string();
112}
113
114double Platform::getTotalSystemMemory()
115{
116 return 0;
117}
118
119double Platform::getMemoryUsage()
120{
121 return 0;
122}
123
124std::string Platform::getOSName()
125{
126 return "android";
127}
128
129std::string Platform::traceback(const std::string& where, int level, int maxDepth)
130{
131 return "";
132}
133
134std::vector<std::string> Platform::getMacAddresses()
135{
136 return std::vector<std::string>();
137}
138
139std::string Platform::getUserName()
140{
141 return "android";
142}
143
144std::vector<std::string> Platform::getDlls()
145{
146 return std::vector<std::string>();
147}
148
149std::vector<std::string> Platform::getProcesses()
150{
151 return std::vector<std::string>();
152}
153
154std::vector<std::string> Platform::getWindows()
155{
156 return std::vector<std::string>();
157}
158
159#endif
160
Top