Read file and run the script.
109{
110 std::string Line;
113 string CommandToExecute = "";
114 string PathOfScriptFile = "";
115
116
117
118
119
120 PathOfScriptFile = PathAndArgs.at(0);
122
123 ifstream File(PathOfScriptFile);
124
125 if (File.is_open())
126 {
128
129
130
131
133
134
135
136
138
139 while (std::getline(File, Line))
140 {
141
142
143
145 {
146
147
148
149 if (Reset)
150 {
151 CommandToExecute.clear();
152 }
153
154
155
156
158
159
160
161
162 CommandToExecute += Line + "\n";
163
164 continue;
165 }
166 else
167 {
168
169
170
172
173
174
175
176 CommandToExecute += Line;
177 }
178
179
180
181
183
184
185
186
187 CommandToExecute.clear();
188 }
189
190
191
192
193 if (!CommandToExecute.empty())
194 {
196
197
198
199
200 CommandToExecute.clear();
201 }
202
203
204
205
207
208 File.close();
209 }
210
211 if (!IsOpened)
212 {
213 ShowMessages("err, invalid file specified for the script\n");
214 }
215}
BOOLEAN CheckMultilineCommand(CHAR *CurrentCommand, BOOLEAN Reset)
check for multi-line commands
Definition interpreter.cpp:1132
VOID CommandScriptRunCommand(std::string Input, vector< string > PathAndArgs)
Run the command.
Definition script.cpp:48
BOOLEAN g_ExecutingScript
Shows whether the target is executing a script form '.script' command or executing script by an argum...
Definition globals.h:502