If TEMPPATH pointed to unexisted, display message and doing nothing instead abort

This commit is contained in:
Stas Degteff 2010-03-11 16:04:08 +00:00
parent e734e7d80a
commit 71abfaf13b
4 changed files with 55 additions and 14 deletions

View File

@ -10,6 +10,10 @@ _____________________________________________________________________________
‡ ¬¥âª¨ ¤«ï GoldED+ 1.1.5, /snapshot/
_____________________________________________________________________________
! …᫨ TEMPPATH 㪠§ë¢ ¥â ­  ­¥áãé¥áâ¢ãî騩 ª â «®£, Golded+ ¯®ª §ë¢ ¥â
á®®¡é¥­¨¥ ¨ ­¨ç¥£® ­¥ ¤¥« ¥â: ¯à¨ ¤¥ª®¤¨à®¢ ­¨¨ UUE, ¯à¨ ¨¬¯®à⥠१ã«ìâ â 
ª®¬ ­¤ë, ¯à¨ ¢ë§®¢¥ ¢­¥è­¥© ã⨫¨âë. <20> ­¥¥ Golded+  ¢ à¨©­® § ¢¥àè «áï.
+ <20>®¢ ï ¤¨à¥ªâ¨¢  ä ©«  goldlang.cfg "IL_TMPINVALIDPATH" (á®®¡é¥­¨¥ "Invalid
path for temporary files (TEMPPATH) - do nothing").

View File

@ -10,6 +10,10 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
! If TEMPPATH is pointed to unexisted directory the Golded+ displays
message and does nothing on UU-decoding, on importing result of shell
command and on calling extern utility. Early Golded+ are aborted.
+ New token IL_TMPINVALIDPATH for goldlang.cfg (message "Invalid path
for temporary files (TEMPPATH) - do nothing").

View File

@ -946,6 +946,17 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
if(filenamebuf.c_str()[0] == '|'){
Path cmdline;
if( not ((*CFG->temppath == NUL ) or is_dir(CFG->temppath)) )
{
w_info(LNG->TMPinvalidpath);
SayBibi();
waitkeyt(10000);
w_info("");
AA->SetXlatimport(__oldxlatimport);
GFTRK(0);
return;
}
isPipe = YES;
mktemp(strxcpy(tmpfile, AddPath(CFG->temppath, "GIXXXXXX"), sizeof(Path)));
strxmerge(cmdline, sizeof(Path), filenamebuf.c_str()+1, " > ", tmpfile, NULL);

View File

@ -538,25 +538,38 @@ void TouchNetscan(int popup)
int ExternUtil(GMsg *msg, const ExtUtil &extutil)
{
Path editorfile, tmpfile, buf;
std::string cmdline = extutil.cmdline;
int mode = (extutil.options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
if(striinc("@tmpfile", cmdline.c_str()))
{
if( (*CFG->temppath == NUL ) or is_dir(CFG->temppath) )
{
mktemp(strcpy(tmpfile, AddPath(CFG->temppath, "GDXXXXXX")));
SaveLines(mode, tmpfile, msg, 79);
strcpy(buf, tmpfile);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@tmpfile", buf);
}
else
{
w_info(LNG->TMPinvalidpath);
SayBibi();
waitkeyt(10000);
w_info("");
return NO;
}
}
else
tmpfile[0] = NUL;
strxcpy(editorfile, AddPath(CFG->goldpath, EDIT->File()), sizeof(Path));
std::string cmdline = extutil.cmdline;
int mode = (extutil.options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
SaveLines(mode, editorfile, msg, 79);
strcpy(buf, editorfile);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@file", buf);
if(striinc("@tmpfile", cmdline.c_str()))
{
mktemp(strcpy(tmpfile, AddPath(CFG->temppath, "GDXXXXXX")));
SaveLines(mode, tmpfile, msg, 79);
strcpy(buf, tmpfile);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@tmpfile", buf);
}
else
tmpfile[0] = NUL;
strcpy(buf, CFG->goldpath);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@path", buf);
@ -840,6 +853,15 @@ void UUDecode(GMsg* msg) {
Path infile, outfile;
bool ok = false;
if( not ((*CFG->temppath == NUL ) or is_dir(CFG->temppath)) )
{
w_info(LNG->TMPinvalidpath);
SayBibi();
waitkeyt(10000);
w_info("");
return;
}
if((*CFG->uudecodepath == NUL) or is_dir(CFG->uudecodepath)) {
mktemp(strcpy(infile, AddPath(CFG->temppath, "GDXXXXXX")));