本文整理汇总了C++中One::GetHostPath方法的典型用法代码示例。如果您正苦于以下问题:C++ One::GetHostPath方法的具体用法?C++ One::GetHostPath怎么用?C++ One::GetHostPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类One
的用法示例。
在下文中一共展示了One::GetHostPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateHostRunDir
void Ide::BuildAndDebug0(const String& srcfile)
{
if(Build()) {
One<Host> h = CreateHostRunDir();
h->ChDir(GetFileFolder(target));
VectorMap<String, String> bm = GetMethodVars(method);
String dbg = bm.Get("DEBUGGER", Null);
if(IsNull(dbg)) {
if(bm.Get("BUILDER", Null) == "MSC71") {
String sln = ForceExt(target, ".sln");
if(GetFileLength(sln) > 0)
h->Launch("devenv \"" + h->GetHostPath(sln) + "\" "
// + "\"" + h->GetHostPath(srcfile) + "\"" //TRC, 2011/09/26: wrong devenv argument
);
else
h->Launch("devenv \"" + h->GetHostPath(target)
//+ "\" \"" + h->GetHostPath(srcfile) //TRC, 2011/09/26: wrong devenv argument
+ "\" /debugexe "
);
return;
}
dbg = "gdb";
}
else
h->Launch('\"' + dbg + "\" \""
// + h->GetHostPath(srcfile) + ' '
+ h->GetHostPath(target) + "\"", true);
}
}
示例2: BuildAndExecute
void Ide::BuildAndExecute()
{
if(Build()) {
int time = msecs();
One<Host> h = CreateHostRunDir();
h->ChDir(Nvl(rundir, GetFileFolder(target)));
String cmdline;
if(!runexternal)
cmdline << '\"' << h->GetHostPath(target) << "\" ";
cmdline << ToSystemCharset(runarg);
int exitcode;
switch(runmode) {
case RUN_WINDOW:
HideBottom();
h->Launch(cmdline, FindIndex(SplitFlags(mainconfigparam, true), "GUI") < 0);
break;
case RUN_CONSOLE:
ShowConsole();
PutConsole(String().Cat() << "Executing: " << cmdline);
console.Sync();
exitcode = h->ExecuteWithInput(cmdline);
PutConsole("Finished in " + GetPrintTime(time) + ", exit code: " + AsString(exitcode));
break;
case RUN_FILE: {
HideBottom();
String fn;
if(IsNull(stdout_file))
fn = ForceExt(target, ".ol");
else
fn = stdout_file;
FileOut out(fn);
if(!out) {
PromptOK("Unable to open output file [* " + DeQtf(stdout_file) + "] !");
return;
}
if(h->Execute(cmdline, out) >= 0) {
out.Close();
EditFile(fn);
}
}
}
}
}
示例3: Valgrind
void Ide::Valgrind()
{
if(!IsValgrind())
return;
static String ValgrindLogFile;
if(IsNull(ValgrindLogFile)) {
StringStream ss;
CreateHostRunDir()->Execute("valgrind --help", ss);
String txt = ss;
if(txt.Find("--log-file-exactly") > 0)
ValgrindLogFile = "--log-file-exactly=";
else
ValgrindLogFile = "--log-file=";
if(txt.Find("--xml-file") > 0)
ValgrindLogFile = "--xml-file=";
}
if(!Build())
return;
One<Host> h = CreateHostRunDir();
h->ChDir(Nvl(rundir, GetFileFolder(target)));
String cmdline;
String fn = GetTempFileName();
cmdline << "valgrind --xml=yes --num-callers=40 " << ValgrindLogFile << fn << ' ';
String ValgSupp = ConfigFile("valgrind.supp");
if(!IsNull(LoadFile(ValgSupp)))
cmdline << "--suppressions=" << ValgSupp << ' ';
cmdline << '\"' << h->GetHostPath(target) << "\" ";
cmdline << runarg;
ConsoleClear();
PutConsole("Valgrind..");
if(IsNull(h->Execute(cmdline))) {
PutConsole("Error executing valgrind");
return;
}
PutConsole("Parsing valgrind output..");
Sync();
String txt = LoadFile(fn);
DeleteFile(fn);
try {
XmlParser p(txt);
while(!p.IsTag())
p.Skip();
p.PassTag("valgrindoutput");
while(!p.End()) {
if(p.Tag("error")) {
String hdr = "Error (missing description)";
String pos;
Vector<String> ln;
bool src = false;
while(!p.End()) {
if(p.Tag("what")) {
hdr = p.ReadText();
p.SkipEnd();
}
else
if(p.Tag("stack")) {
while(!p.End()) {
String ip = "?";
String obj;
String fn;
String dir;
String file;
String line;
if(p.Tag("frame")) {
bool hasdir = false;
bool hasfile = false;
bool hasline = false;
bool haspos = false;
while(!p.End()) {
if(p.Tag("ip")) {
ip = p.ReadText();
p.SkipEnd();
}
else
if(p.Tag("obj")) {
obj = p.ReadText();
p.SkipEnd();
haspos = true;
}
else
if(p.Tag("fn")) {
fn = p.ReadText();
p.SkipEnd();
}
else
if(p.Tag("dir")) {
dir = p.ReadText();
p.SkipEnd();
hasdir = true;
}
else
if(p.Tag("file")) {
file = p.ReadText();
p.SkipEnd();
hasfile = true;
}
else
if(p.Tag("line")) {
line = p.ReadText();
p.SkipEnd();
//.........这里部分代码省略.........
示例4: SaveMakeFile
void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
{
BeginBuilding(false, true);
VectorMap<String, String> bm = GetMethodVars(method);
One<Host> host = CreateHost(false);
One<Builder> b = CreateBuilder(~host);
if(!b)
return;
const TargetMode& tm = GetTargetMode();
String makefile;
Vector<String> uppdirs = GetUppDirs();
String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
String inclist;
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b);
bool win32 = allconfig.Find("WIN32") >= 0;
Workspace wspc;
wspc.Scan(GetMain(), allconfig.GetKeys());
for(int i = 1; i < wspc.GetCount(); i++) {
Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
for(int a = allconfig.GetCount(); --a >= 0;)
if(modconfig.Find(allconfig[a]) < 0)
allconfig.Remove(a);
}
if(!exporting)
for(int i = 0; i < uppdirs.GetCount(); i++) {
String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32);
makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n";
inclist << " -I$(UPPDIR" << (i + 1) << ")";
}
else
inclist << "-I./";
Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
for(int i = 0; i < includes.GetCount(); i++)
inclist << " -I" << includes[i];
makefile << "\n"
"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n"
"CINC = " << inclist << "\n"
"Macro = ";
for(int i = 0; i < allconfig.GetCount(); i++)
makefile << " -Dflag" << allconfig[i];
makefile << "\n";
String output, config, install, rules, linkdep, linkfiles, linkfileend;
for(int i = 0; i < wspc.GetCount(); i++) {
b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
b->version = tm.version;
b->method = method;
MakeFile mf;
b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i),
GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig,
exporting);
if(!i) {
String tdir = mf.outdir;
String trg;
if(tm.target_override) {
trg = GetMakePath(AdjustMakePath(tm.target), win32);
if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/'))
trg << mf.outfile;
else if(trg.Find(win32 ? '\\' : '/') < 0)
trg.Insert(0, "$(OutDir)");
}
output = Nvl(trg, mf.output);
if(exporting)
output = wspc[i] + ".out";
install << "\n"
"OutDir = " << tdir << "\n"
"OutFile = " << output << "\n"
"\n"
".PHONY: all\n"
"all: prepare $(OutFile)\n"
"\n"
".PHONY: prepare\n"
"prepare:\n";
}
config << mf.config;
install << mf.install;
rules << mf.rules;
linkdep << mf.linkdep;
linkfiles << mf.linkfiles;
linkfileend << mf.linkfileend;
}
makefile
<< config
<< install
<< "\n"
"$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n"
<< rules
//.........这里部分代码省略.........
示例5: GetHostPath
virtual String GetHostPath(const String& path) { return host->GetHostPath(path); }