mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.ide .rc file works when upp localization contains space on GCC.
git-svn-id: svn://ultimatepp.org/upp/trunk@10972 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
18fa1dd547
commit
eccc14f4ba
6 changed files with 70 additions and 54 deletions
|
|
@ -267,6 +267,7 @@ struct OneFileHost : Host {
|
|||
virtual One<AProcess> StartProcess(const char *c) { return host->StartProcess(c); }
|
||||
virtual void Launch(const char *cmdline, bool) { host->Launch(cmdline); }
|
||||
virtual void AddFlags(Index<String>& cfg) { host->AddFlags(cfg); }
|
||||
virtual const Vector<String>& GetExecutablesDirs() const { return host->GetExecutablesDirs(); }
|
||||
|
||||
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) {
|
||||
Vector<FileInfo> fi = host->GetFileInfo(path);
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile, V
|
|||
bool execerr = false;
|
||||
if(rc) {
|
||||
String exec;
|
||||
exec << "windres -i " << GetHostPathQ(fn);
|
||||
exec << GetHostPathShort(FindInDirs(host->GetExecutablesDirs(), "windres.exe")) << " -i " << GetHostPathQ(fn);
|
||||
if(cc.Find(" -m32 ") >= 0)
|
||||
exec << " --target=pe-i386 ";
|
||||
exec << " -o " << GetHostPathQ(objfile) << IncludesShort(" --include-dir=", package, pkg)
|
||||
|
|
|
|||
|
|
@ -13,11 +13,14 @@ String Builder::GetHostPath(const String& path) const
|
|||
String Builder::GetHostPathShort(const String& path) const
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
const dword SHORT_PATH_LENGTH = 2048;
|
||||
char short_path[SHORT_PATH_LENGTH];
|
||||
dword length = ::GetShortPathName((LPCTSTR) path, (LPTSTR) short_path, SHORT_PATH_LENGTH);
|
||||
dword length = ::GetShortPathName(static_cast<LPCTSTR>(path), nullptr, 0);
|
||||
if(length == 0)
|
||||
return path;
|
||||
Buffer<char> shortPathBuffer(length);
|
||||
length = ::GetShortPathName(
|
||||
static_cast<LPCTSTR>(path), static_cast<LPTSTR>(~shortPathBuffer), length);
|
||||
if(length > 0)
|
||||
return String(short_path, length);
|
||||
return String(shortPathBuffer, length);
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,6 +364,11 @@ void LocalHost::AddFlags(Index<String>& cfg)
|
|||
#endif
|
||||
}
|
||||
|
||||
const Vector<String>& LocalHost::GetExecutablesDirs() const
|
||||
{
|
||||
return exedirs;
|
||||
}
|
||||
|
||||
bool LocalHost::HasPlatformFlag(const Index<String>& cfg)
|
||||
{
|
||||
static const Index<String> platformFlags = {
|
||||
|
|
|
|||
|
|
@ -2,35 +2,38 @@ enum { REMOTE_TIMEOUT = 2000 };
|
|||
|
||||
extern String LinuxHostConsole;
|
||||
|
||||
struct Host {
|
||||
class Host {
|
||||
public:
|
||||
virtual ~Host() {}
|
||||
|
||||
struct FileInfo : Time, Moveable<FileInfo> {
|
||||
int length;
|
||||
};
|
||||
virtual String GetEnvironment() = 0;
|
||||
virtual String GetHostPath(const String& path) = 0;
|
||||
virtual String GetLocalPath(const String& path) = 0;
|
||||
virtual String NormalizePath(const String& path) = 0;
|
||||
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) = 0;
|
||||
virtual void DeleteFile(const Vector<String>& path) = 0;
|
||||
virtual void DeleteFolderDeep(const String& dir) = 0;
|
||||
virtual void ChDir(const String& path) = 0;
|
||||
virtual bool RealizeDir(const String& path) = 0;
|
||||
virtual bool SaveFile(const String& path, const String& data) = 0;
|
||||
virtual String LoadFile(const String& path) = 0;
|
||||
virtual int Execute(const char *cmdline) = 0;
|
||||
virtual int ExecuteWithInput(const char *cmdline, bool noconvert) = 0;
|
||||
virtual int Execute(const char *cmdline, Stream& out, bool noconvert = false) = 0;
|
||||
virtual int AllocSlot() = 0;
|
||||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Wait() = 0;
|
||||
virtual bool Wait(int slot) = 0;
|
||||
virtual void OnFinish(Event<> cb) = 0;
|
||||
virtual One<AProcess> StartProcess(const char *cmdline) = 0;
|
||||
virtual void Launch(const char *cmdline, bool console = false) = 0;
|
||||
virtual void AddFlags(Index<String>& cfg) = 0;
|
||||
|
||||
virtual ~Host() {}
|
||||
|
||||
virtual String GetEnvironment() = 0;
|
||||
virtual String GetHostPath(const String& path) = 0;
|
||||
virtual String GetLocalPath(const String& path) = 0;
|
||||
virtual String NormalizePath(const String& path) = 0;
|
||||
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) = 0;
|
||||
virtual void DeleteFile(const Vector<String>& path) = 0;
|
||||
virtual void DeleteFolderDeep(const String& dir) = 0;
|
||||
virtual void ChDir(const String& path) = 0;
|
||||
virtual bool RealizeDir(const String& path) = 0;
|
||||
virtual bool SaveFile(const String& path, const String& data) = 0;
|
||||
virtual String LoadFile(const String& path) = 0;
|
||||
virtual int Execute(const char *cmdline) = 0;
|
||||
virtual int ExecuteWithInput(const char *cmdline, bool noconvert) = 0;
|
||||
virtual int Execute(const char *cmdline, Stream& out, bool noconvert = false) = 0;
|
||||
virtual int AllocSlot() = 0;
|
||||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0;
|
||||
virtual bool Wait() = 0;
|
||||
virtual bool Wait(int slot) = 0;
|
||||
virtual void OnFinish(Event<> cb) = 0;
|
||||
virtual One<AProcess> StartProcess(const char *cmdline) = 0;
|
||||
virtual void Launch(const char *cmdline, bool console = false) = 0;
|
||||
virtual void AddFlags(Index<String>& cfg) = 0;
|
||||
virtual const Vector<String>& GetExecutablesDirs() const = 0;
|
||||
};
|
||||
|
||||
class LocalHost : public Host {
|
||||
|
|
@ -41,29 +44,31 @@ public:
|
|||
String *cmdout;
|
||||
void DoDir(const String& s);
|
||||
|
||||
virtual String GetEnvironment();
|
||||
virtual String GetHostPath(const String& path);
|
||||
virtual String GetLocalPath(const String& path);
|
||||
virtual String NormalizePath(const String& path);
|
||||
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path);
|
||||
virtual void DeleteFile(const Vector<String>& path);
|
||||
virtual void DeleteFolderDeep(const String& dir);
|
||||
virtual void ChDir(const String& path);
|
||||
virtual bool RealizeDir(const String& path);
|
||||
virtual bool SaveFile(const String& path, const String& data);
|
||||
virtual String LoadFile(const String& path);
|
||||
virtual int Execute(const char *cmdline);
|
||||
virtual int ExecuteWithInput(const char *cmdline, bool noconvert);
|
||||
virtual int Execute(const char *cmdline, Stream& out, bool noconvert = false);
|
||||
virtual int AllocSlot();
|
||||
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count);
|
||||
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
|
||||
virtual bool Wait();
|
||||
virtual bool Wait(int slot);
|
||||
virtual void OnFinish(Event<> cb);
|
||||
virtual One<AProcess> StartProcess(const char *cmdline);
|
||||
virtual void Launch(const char *cmdline, bool console);
|
||||
virtual void AddFlags(Index<String>& cfg);
|
||||
public: /* Host */
|
||||
String GetEnvironment() override;
|
||||
String GetHostPath(const String& path) override;
|
||||
String GetLocalPath(const String& path) override;
|
||||
String NormalizePath(const String& path) override;
|
||||
Vector<FileInfo> GetFileInfo(const Vector<String>& path) override;
|
||||
void DeleteFile(const Vector<String>& path) override;
|
||||
void DeleteFolderDeep(const String& dir) override;
|
||||
void ChDir(const String& path) override;
|
||||
bool RealizeDir(const String& path) override;
|
||||
bool SaveFile(const String& path, const String& data) override;
|
||||
String LoadFile(const String& path) override;
|
||||
int Execute(const char *cmdline) override;
|
||||
int ExecuteWithInput(const char *cmdline, bool noconvert) override;
|
||||
int Execute(const char *cmdline, Stream& out, bool noconvert = false) override;
|
||||
int AllocSlot() override;
|
||||
bool Run(const char *cmdline, int slot, String key, int blitz_count) override;
|
||||
bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) override;
|
||||
bool Wait() override;
|
||||
bool Wait(int slot) override;
|
||||
void OnFinish(Event<> cb) override;
|
||||
One<AProcess> StartProcess(const char *cmdline) override;
|
||||
void Launch(const char *cmdline, bool console) override;
|
||||
void AddFlags(Index<String>& cfg) override;
|
||||
const Vector<String>& GetExecutablesDirs() const override;
|
||||
|
||||
private:
|
||||
bool HasPlatformFlag(const Index<String>& cfg);
|
||||
|
|
|
|||
|
|
@ -335,6 +335,8 @@ bool Gdb::Key(dword key, int count)
|
|||
bool Gdb::Create(One<Host>&& _host, const String& exefile, const String& cmdline, bool console)
|
||||
{
|
||||
host = pick(_host);
|
||||
|
||||
// TODO: Normalize exe path should be part of the host. What about remote GDB?
|
||||
dbg = host->StartProcess(GdbCommand(console) + NormalizeExePath(GetHostPath(exefile)));
|
||||
if(!dbg) {
|
||||
ErrorOK("Error while invoking gdb!");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue