Fixed a relative path usage

This commit is contained in:
Stas Degteff 2005-11-06 11:50:08 +00:00
parent 8b49add1be
commit d0ca6c8af9
3 changed files with 13 additions and 11 deletions

View File

@ -10,13 +10,17 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
- Relative path usage is fixed. Now a Real UID is used to parse "~/" always.
+ Several unicode charset convertion tables is included into distribution of
the config examples.
+ Relative path may be used for patchnames definiions in config. User's home
directory (~/) may be used in unixes. Example:
+ Gedlnx: Relative path may be used for patchnames definiions in config.
User's home directory (~/) may be used in unixes. Examples:
include ~/golded.cfg ; include the user-specific subconfig
include ~/golded.cfg ; include the user-specific subconfig of current user
include ~fido/configs/golded.cfg ; include specific subconfig of user fido
seqdir ~fido ; specify MSGID-sequence store path to /home/fido/
! Temporarily disabled the AreaRecycleBin.

View File

@ -317,11 +317,9 @@ void TouchFile(const char* filename) {
char* PathCopy(char* __dst, const char* __src) {
strschg_environ(strxcpy(__dst, __src, sizeof(Path)));
getcwd(__dst, sizeof(Path)); // expand ~/ & etc.
return AddBackslash(__dst);
}
// ------------------------------------------------------------------
int TestLockPath(const char* __path) {

View File

@ -77,7 +77,7 @@ int strschg_environ(std::string& s) {
size_t posn, posn1;
while(((posn=s.find('%')) != s.npos) and ((posn1=s.find('%', posn+1)) != s.npos)) {
fnd = s.substr(posn+1, posn1-1);
fnd = s.substr(posn+1, posn1-1);
const char* rep = getenv(fnd.c_str());
rep = rep ? rep : "";
s.replace(posn, posn1-posn+1, rep);
@ -89,16 +89,16 @@ int strschg_environ(std::string& s) {
std::string name;
char* lname;
const char *p = s.c_str()+1;
struct passwd *pe=NULL;
if((s.length() != 1) and not isslash(*p)) {
while(*p and not isslash(*p))
name += *p++;
pe = getpwnam(name.c_str());
}
else {
if ((lname = getlogin()) == NULL)
lname = getenv("LOGNAME");
name = lname;
pe = getpwuid(getuid());
}
struct passwd *pe = getpwnam(name.c_str());
if(pe != NULL) {
std::string dirname = pe->pw_dir;
dirname += "/";
@ -161,7 +161,7 @@ bool maketruepath(std::string &dirname) {
else {
dirname = cwd;
ok = false;
}
}
#else
long inspos = -1;
if((dirname.length() == 2) and (dirname[1] == ':'))