Created
March 3, 2011 05:07
-
-
Save miau/852360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur gvedit/UPreProcess.cpp gvedit_mine/UPreProcess.cpp | |
--- gvedit/UPreProcess.cpp Tue Feb 02 04:19:53 2010 | |
+++ gvedit_mine/UPreProcess.cpp Wed Mar 02 01:57:59 2011 | |
@@ -46,7 +46,7 @@ | |
void __fastcall TfrmPre::Button3Click(TObject *Sender) | |
{ | |
TIniFile *ini; | |
- AnsiString FileName=ExtractFilePath( Application->ExeName)+"Settings.ini" ; | |
+ AnsiString FileName = getIniFile(); | |
if(FileExists(FileName)) | |
{ | |
ini = new TIniFile(FileName); | |
diff -ur gvedit/USettings.cpp gvedit_mine/USettings.cpp | |
--- gvedit/USettings.cpp Tue Feb 02 04:19:53 2010 | |
+++ gvedit_mine/USettings.cpp Wed Mar 02 02:03:52 2011 | |
@@ -145,7 +145,7 @@ | |
sl->Add("InitialDir1=C:\\"); | |
sl->Add("InitialDir2=C:\\"); | |
sl->Add("InitialDir3=C:\\"); | |
- sl->Add("binPath=C:\\Program Files\\Graphviz2.26\\bin\\"); | |
+ sl->Add("binPath=" + ExtractFilePath(Application->ExeName)); | |
sl->Add("init=1"); | |
sl->SaveToFile(rv); | |
} | |
@@ -355,8 +355,8 @@ | |
SendMessage(frmMain->Memo1->Handle, EM_SCROLLCARET,0,0); | |
DeleteFile(szTempFile); | |
} | |
- if (preprocflag) | |
- DeleteFile(tempFile); | |
+// if (preprocflag) | |
+// DeleteFile(tempFile); | |
delete tmpString; | |
} | |
return true; | |
@@ -516,10 +516,12 @@ | |
SECURITY_ATTRIBUTES saAttr; | |
BOOL fSuccess; | |
- AnsiString hinputfile=ExtractFilePath(Application->ExeName)+"__temp.dot"; | |
+ char tempPath[1024]; | |
+ GetTempPath(1024, tempPath); | |
+ AnsiString inputFile = AnsiString(tempPath) + "__temp.dot"; | |
// Set the bInheritHandle flag so pipe handles are inherited. | |
- if (!FileExists(hinputfile)) | |
+ if (!FileExists(inputFile)) | |
{ | |
ErrorExit("Temporary file is missing!"); | |
return 0; | |
@@ -552,10 +554,10 @@ | |
// Get a handle to the parent's input file. | |
- if (hinputfile.Trim() =="") | |
+ if (inputFile.Trim() == "") | |
ErrorExit("Please specify an input file"); | |
- hInputFile = CreateFile(hinputfile.c_str(), GENERIC_READ, 0, NULL, | |
+ hInputFile = CreateFile(inputFile.c_str(), GENERIC_READ, 0, NULL, | |
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL); | |
if (hInputFile == INVALID_HANDLE_VALUE) | |
@@ -671,15 +673,19 @@ | |
// Read output from the child process, and write to parent's STDOUT. | |
TStringList* tmpString=new TStringList(); | |
+ AnsiString tmpStr; | |
for (;;) | |
{ | |
if( !ReadFile( hChildStdoutRd, chBuf, BUFSIZE, &dwRead, | |
NULL) || dwRead == 0) break; | |
- tmpString->Text=tmpString->Text+chBuf; | |
+ DWORD dwNewLength = tmpStr.Length() + dwRead; | |
+ tmpStr += chBuf; | |
+ tmpStr.SetLength(dwNewLength); | |
/* if (! WriteFile(hStdout, chBuf, dwRead, &dwWritten, NULL)) | |
break;*/ | |
} | |
+ tmpString->Text = tmpStr; | |
if(!CloseHandle(hChildStdoutRd)) | |
ErrorExit("Closing handle failed"); | |
@@ -687,7 +693,9 @@ | |
if (tmpString->Text.Trim() !="") | |
{ | |
preprocflag=true; | |
- tmpString->SaveToFile(ExtractFilePath(Application->ExeName)+"__temp2.dot"); | |
+ char tempPath[1024]; | |
+ GetTempPath(1024, tempPath); | |
+ tmpString->SaveToFile(AnsiString(tempPath) + "__temp.dot"); | |
} | |
/* if (frmSettings->CheckBox3->Checked) | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment