MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / readCommand

Method readCommand

source/util/player.cpp:42–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40Player* Player::instance;
41
42void Player::readCommand() {
43 this->nextCommand.clear();
44 this->nextValue.clear();
45
46 BString line;
47 if (!file.readLine(line)) {
48 klog("script finished: success");
49 this->nextCommand = B("DONE"); // will cause success exit code to be returned
50 KSystem::killTime = KSystem::getMilliesSinceStart() + 30000;
51 return;
52 }
53 std::vector<BString> results;
54 line.split("=", results);
55 if (results.size() == 2) {
56 this->nextCommand = results[0];
57 this->nextValue = results[1];
58 } else if (results.size() == 1) {
59 this->nextCommand = results[0];
60 } else {
61 klog_fmt("malformed script. Line = %s", line.c_str());
62#ifdef BOXEDWINE_MULTI_THREADED
63 KSystem::destroy();
64#endif
65 exit(99);
66 }
67 this->lastCommandTime = KSystem::getMicroCounter();
68 if (this->nextCommand.length()==0) {
69 klog_fmt("malformed script. Line = %s", line.c_str());
70#ifdef BOXEDWINE_MULTI_THREADED
71 KSystem::destroy();
72#endif
73 exit(99);
74 }
75}
76
77bool Player::start(BString directory) {
78 Player::instance = new Player();

Callers 3

startMethod · 0.80
initCommandLineMethod · 0.80
runSliceMethod · 0.80

Calls 10

klogFunction · 0.85
BFunction · 0.85
klog_fmtFunction · 0.85
destroyFunction · 0.85
readLineMethod · 0.80
clearMethod · 0.45
splitMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected