Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions core/base/src/TEnv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -415,19 +415,17 @@ TEnv::TEnv(const char *name)

TString sname = "system";
sname += name;
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
const char *s = gSystem->PrependPathName(TROOT::GetEtcDir(), sname);
ReadFile(s, kEnvGlobal);
delete [] s;

if (!gSystem->Getenv("ROOTENV_NO_HOME")) {
if (const auto rootrcPath = gSystem->Getenv("ROOTENV_USER_PATH")) {
s = gSystem->ConcatFileName(rootrcPath, name);
ReadFile(s, kEnvUser);
delete[] s;
TString temp(name);
const char *s1 = gSystem->PrependPathName(rootrcPath, temp);
ReadFile(s1, kEnvUser);
} else {
s = gSystem->ConcatFileName(gSystem->HomeDirectory(), name);
ReadFile(s, kEnvUser);
delete[] s;
TString temp(name);
const char *s1 = gSystem->PrependPathName(gSystem->HomeDirectory(), temp);
ReadFile(s1, kEnvUser);
}
if (strcmp(gSystem->HomeDirectory(), gSystem->WorkingDirectory())) {
ReadFile(name, kEnvLocal);
Expand Down Expand Up @@ -694,13 +692,9 @@ void TEnv::SaveLevel(EEnvLevel level)

TString sname = "system";
sname += fRcName;
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
rootrcdir = s;
delete [] s;
rootrcdir = gSystem->PrependPathName(TROOT::GetEtcDir(), sname);
} else if (level == kEnvUser) {
char *s = gSystem->ConcatFileName(gSystem->HomeDirectory(), fRcName);
rootrcdir = s;
delete [] s;
rootrcdir = gSystem->PrependPathName(gSystem->HomeDirectory(), fRcName);
} else if (level == kEnvLocal)
rootrcdir = fRcName;
else
Expand Down
20 changes: 8 additions & 12 deletions core/base/src/TPluginManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,10 @@ void TPluginManager::LoadHandlerMacros(const char *path)
while ((f1 = gSystem->GetDirEntry(dirp))) {
TString f = f1;
if (f[0] == 'P' && f.EndsWith(".C")) {
const char *p = gSystem->ConcatFileName(path, f);
const char *p = gSystem->PrependPathName(path, f);
if (!gSystem->AccessPathName(p, kReadPermission)) {
macros.Add(new TObjString(p));
}
delete [] p;
}
}
// load macros in alphabetical order
Expand Down Expand Up @@ -533,9 +532,8 @@ void TPluginManager::LoadHandlersFromPluginDirs(const char *base)
}
if (!skip) {
if (sbase != "") {
const char *p = gSystem->ConcatFileName(d, sbase);
const char *p = gSystem->PrependPathName(d, sbase);
LoadHandlerMacros(p);
delete [] p;
} else {
void *dirp = gSystem->OpenDirectory(d);
if (dirp) {
Expand All @@ -544,10 +542,10 @@ void TPluginManager::LoadHandlersFromPluginDirs(const char *base)
const char *f1;
while ((f1 = gSystem->GetDirEntry(dirp))) {
TString f = f1;
const char *p = gSystem->ConcatFileName(d, f);
LoadHandlerMacros(p);
TString temp = f1;
const char *p1 = gSystem->PrependPathName(d, temp);
LoadHandlerMacros(p1);
fBasesLoaded->Add(new TObjString(f));
delete [] p;
}
}
gSystem->FreeDirectory(dirp);
Expand Down Expand Up @@ -688,10 +686,9 @@ Int_t TPluginManager::WritePluginMacros(const char *dir, const char *plugin) con
base = h->fBase;
} else
idx += 10;
const char *dd = gSystem->ConcatFileName(d, h->fBase);
TString sdd = dd;
TString temp = h->fBase;
TString sdd = gSystem->PrependPathName(d, temp);
sdd.ReplaceAll("::", "@@");
delete [] dd;
if (gSystem->AccessPathName(sdd, kWritePermission)) {
if (gSystem->MakeDirectory(sdd) < 0) {
Error("WritePluginMacros", "cannot create directory %s", sdd.Data());
Expand All @@ -700,7 +697,7 @@ Int_t TPluginManager::WritePluginMacros(const char *dir, const char *plugin) con
}
TString fn;
fn.Form("P%03d_%s.C", idx, h->fClass.Data());
const char *fd = gSystem->ConcatFileName(sdd, fn);
const char *fd = gSystem->PrependPathName(sdd, fn);
FILE *f = fopen(fd, "w");
if (f) {
fprintf(f, "void P%03d_%s()\n{\n", idx, h->fClass.Data());
Expand All @@ -726,7 +723,6 @@ Int_t TPluginManager::WritePluginMacros(const char *dir, const char *plugin) con
fprintf(f, "}\n");
fclose(f);
}
delete [] fd;
lnk = lnk->Next();
}
return 0;
Expand Down
66 changes: 36 additions & 30 deletions core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2586,8 +2586,8 @@ static void R__WriteDependencyFile(const TString & build_loc, const TString &dep
#ifndef WIN32
const char * stderrfile = "/dev/null";
#else
TString stderrfile;
AssignAndDelete( stderrfile, gSystem->ConcatFileName(build_loc,"stderr.tmp") );
TString stderrfile= "stderr.tmp";
gSystem->PrependPathName(build_loc, stderrfile);
#endif
TString bakdepfilename = depfilename + ".bak";

Expand Down Expand Up @@ -2898,7 +2898,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
if (build_loc == ".") {
build_loc = WorkingDirectory();
} else if (build_loc.Length() && (!IsAbsoluteFileName(build_loc)) ) {
AssignAndDelete( build_loc , ConcatFileName( WorkingDirectory(), build_loc ) );
PrependPathName( WorkingDirectory(), build_loc );
}

// Get the include directory list in the dir1:dir2:dir3 format
Expand Down Expand Up @@ -2991,7 +2991,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
library = library_specified;
ExpandPathName( library );
if (! IsAbsoluteFileName(library) ) {
AssignAndDelete( library , ConcatFileName( WorkingDirectory(), library ) );
PrependPathName( WorkingDirectory(), library );
}
libname_noext = library_specified;
library = TString(library) + "." + fSoExt;
Expand Down Expand Up @@ -3030,15 +3030,17 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
if (pos==0) lib_location.Remove(pos,3);

if (flatBuildDir) {
AssignAndDelete( library, ConcatFileName( build_loc, libname_ext) );
library = libname_ext;
PrependPathName( build_loc, library) ;
} else {
AssignAndDelete( library, ConcatFileName( build_loc, library) );
PrependPathName( build_loc, library) ;
}

Bool_t canWriteBuild_loc = !gSystem->AccessPathName(build_loc,kWritePermission);
TString build_loc_store( build_loc );
if (!flatBuildDir) {
AssignAndDelete( build_loc, ConcatFileName( build_loc, lib_location) );
TString temp_lib_location = lib_location;
build_loc = PrependPathName( build_loc, temp_lib_location);
}

if (gSystem->AccessPathName(build_loc,kFileExists)) {
Expand Down Expand Up @@ -3084,7 +3086,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
while( len != 0 ) {
TString sub = includes(pos,len);
sub.Remove(0,3); // Remove ' -I'
AssignAndDelete( sub, ConcatFileName( WorkingDirectory(), sub ) );
PrependPathName( WorkingDirectory(), sub );
sub.Prepend(" -I\"");
if (sub.EndsWith(" "))
sub.Chop(); // Remove trailing space (i.e between the -Is ...
Expand All @@ -3101,7 +3103,7 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
while( len != 0 ) {
TString sub = includes(pos,len);
sub.Remove(0,4); // Remove ' -I"'
AssignAndDelete( sub, ConcatFileName( WorkingDirectory(), sub ) );
PrependPathName( WorkingDirectory(), sub );
sub.Prepend(" -I\"");
includes.Replace(pos,len,sub);
pos = rel_inc.Index(includes,&len);
Expand Down Expand Up @@ -3140,7 +3142,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
{
UserGroup_t *ug = gSystem->GetUserInfo(gSystem->GetUid());
if (ug) {
AssignAndDelete( emergency_loc, ConcatFileName( TempDirectory(), ug->fUser ) );
emergency_loc = (ug->fUser).Data();
PrependPathName( TempDirectory(), emergency_loc );
delete ug;
} else {
emergency_loc = TempDirectory();
Expand All @@ -3153,8 +3156,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,

// Generate the dependency filename
TString depdir = build_loc;
TString depfilename;
AssignAndDelete( depfilename, ConcatFileName(depdir, BaseName(libname_noext)) );
TString depfilename = BaseName(libname_noext);
PrependPathName(depdir, depfilename);
depfilename += "_" + extension + ".d";

if ( !recompile ) {
Expand All @@ -3174,7 +3177,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
if ( gSystem->GetPathInfo( depfilename, nullptr,(Long_t*) nullptr, nullptr, &file_time ) != 0 ) {
if (!canWrite) {
depdir = emergency_loc;
AssignAndDelete( depfilename, ConcatFileName(depdir, BaseName(libname_noext)) );
depfilename = BaseName(libname_noext);
PrependPathName(depdir, depfilename);
depfilename += "_" + extension + ".d";
}
R__WriteDependencyFile(build_loc, depfilename, filename_fullpath, library, libname, extension, version_var_prefix, includes, defines, incPath);
Expand Down Expand Up @@ -3326,8 +3330,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,

}

TString libmapfilename;
AssignAndDelete( libmapfilename, ConcatFileName( build_loc, libname ) );
TString libmapfilename = libname;
PrependPathName( build_loc, libmapfilename );
libmapfilename += ".rootmap";
#if (defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_5)) || defined(R__WIN32)
Bool_t produceRootmap = kTRUE;
Expand Down Expand Up @@ -3439,17 +3443,16 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
dict.ReplaceAll( forbidden_chars[ic],"_" );
}
if ( dict.Last('.')!=dict.Length()-1 ) dict.Append(".");
AssignAndDelete( dict, ConcatFileName( build_loc, dict ) );
PrependPathName( build_loc, dict ) ;
TString dicth = dict;
TString dictObj = dict;
dict += "cxx"; //no need to keep the extension of the original file, any extension will do
dicth += "h";
dictObj += fObjExt;

// ======= Generate a linkdef file

TString linkdef;
AssignAndDelete( linkdef, ConcatFileName( build_loc, libname ) );
TString linkdef = libname;
PrependPathName( build_loc, linkdef );
linkdef += "_ACLiC_linkdef.h";
std::ofstream linkdefFile( linkdef, std::ios::out );
linkdefFile << "// File Automatically generated by the ROOT Script Compiler "
Expand Down Expand Up @@ -3500,8 +3503,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
linkdefFile.close();
// ======= Generate the list of rootmap files to be looked at

TString mapfile;
AssignAndDelete( mapfile, ConcatFileName( build_loc, libname ) );
TString mapfile = libname;
PrependPathName( build_loc, mapfile );
mapfile += "_ACLiC_map";
TString mapfilein = mapfile + ".in";
TString mapfileout = mapfile + ".out";
Expand All @@ -3518,20 +3521,23 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
{
TString name = ".rootmap";
TString sname = "system.rootmap";
TString file;
AssignAndDelete(file, ConcatFileName(TROOT::GetEtcDir(), sname) );
TString file = sname;
PrependPathName(TROOT::GetEtcDir(), file);
if (gSystem->AccessPathName(file)) {
// for backward compatibility check also $ROOTSYS/system<name> if
// $ROOTSYS/etc/system<name> does not exist
AssignAndDelete(file, ConcatFileName(TROOT::GetRootSys(), sname));
file = sname;
PrependPathName(TROOT::GetRootSys(), file);
if (gSystem->AccessPathName(file)) {
// for backward compatibility check also $ROOTSYS/<name> if
// $ROOTSYS/system<name> does not exist
AssignAndDelete(file, ConcatFileName(TROOT::GetRootSys(), name));
file = name;
PrependPathName(TROOT::GetRootSys(), file);
}
}
mapfileStream << file << std::endl;
AssignAndDelete(file, ConcatFileName(gSystem->HomeDirectory(), name) );
file = name;
PrependPathName(gSystem->HomeDirectory(), file );
mapfileStream << file << std::endl;
mapfileStream << name << std::endl;
if (gInterpreter->GetRootMapFiles()) {
Expand Down Expand Up @@ -3748,8 +3754,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
#endif

TString testcmd = fMakeExe;
TString fakeMain;
AssignAndDelete( fakeMain, ConcatFileName( build_loc, libname ) );
TString fakeMain = libname;
PrependPathName( build_loc, fakeMain );
fakeMain += "_ACLiC_main";
fakeMain += extension;
std::ofstream fakeMainFile( fakeMain, std::ios::out );
Expand All @@ -3765,8 +3771,8 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt,
// however compilation would fail if a main is already there
// (like stress.cxx)
// dict.Append(" ").Append(fakeMain);
TString exec;
AssignAndDelete( exec, ConcatFileName( build_loc, libname ) );
TString exec = libname;
PrependPathName( build_loc, exec );
exec += "_ACLiC_exec";
testcmd.ReplaceAll("$SourceFiles","-D__ACLIC__ \"$SourceFiles\"");
testcmd.ReplaceAll("$SourceFiles",dict);
Expand Down
10 changes: 4 additions & 6 deletions core/base/src/TSystemFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ void TSystemFile::Copy(const char *to)

if (IsDirectory(to)) {
if (name.EndsWith("/")) name.Chop();
char *s = gSystem->ConcatFileName(name, fName);
name = s;
delete [] s;
TString temp = fName;
name = gSystem->PrependPathName(name, temp);
}

Int_t status = gSystem->CopyFile(fName, name, kFALSE);
Expand All @@ -132,9 +131,8 @@ void TSystemFile::Move(const char *to)

if (IsDirectory(to)) {
if (name.EndsWith("/")) name.Chop();
char *s = gSystem->ConcatFileName(name, fName);
name = s;
delete [] s;
TString temp = fName;
name = gSystem->PrependPathName(name, temp);
}
Int_t status = gSystem->CopyFile(fName, name, kFALSE);

Expand Down
16 changes: 8 additions & 8 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5729,18 +5729,18 @@ void TCling::InitRootmapFile(const char *name)

TString sname = "system";
sname += name;
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
TString temp_sname = sname;
const char *s1 = gSystem->PrependPathName(TROOT::GetEtcDir(), temp_sname);

Int_t ret = ReadRootmapFile(s);
Int_t ret = ReadRootmapFile(s1);
if (ret == -3) // old format
fMapfile->ReadFile(s, kEnvGlobal);
delete [] s;
fMapfile->ReadFile(s1, kEnvGlobal);
if (!gSystem->Getenv("ROOTENV_NO_HOME")) {
s = gSystem->ConcatFileName(gSystem->HomeDirectory(), name);
ret = ReadRootmapFile(s);
TString temp_name = name;
const char *s2 = gSystem->PrependPathName(gSystem->HomeDirectory(), temp_name);
ret = ReadRootmapFile(s2);
if (ret == -3) // old format
fMapfile->ReadFile(s, kEnvUser);
delete [] s;
fMapfile->ReadFile(s2, kEnvUser);
if (strcmp(gSystem->HomeDirectory(), gSystem->WorkingDirectory())) {
ret = ReadRootmapFile(name);
if (ret == -3) // old format
Expand Down
12 changes: 6 additions & 6 deletions core/rint/src/TRint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,16 @@ void TRint::ExecLogon()
TString name = ".rootlogon.C";
TString sname = "system";
sname += name;
char *s = gSystem->ConcatFileName(TROOT::GetEtcDir(), sname);
TString temp_sname = sname;
TString temp_name = name;
const char *s = gSystem->PrependPathName(TROOT::GetEtcDir(), temp_sname);
if (!gSystem->AccessPathName(s, kReadPermission)) {
ProcessFile(s);
}
delete [] s;
s = gSystem->ConcatFileName(gSystem->HomeDirectory(), name);
if (!gSystem->AccessPathName(s, kReadPermission)) {
ProcessFile(s);
const char *s1 = gSystem->PrependPathName(gSystem->HomeDirectory(), temp_name);
if (!gSystem->AccessPathName(s1, kReadPermission)) {
ProcessFile(s1);
}
delete [] s;
// avoid executing ~/.rootlogon.C twice
if (strcmp(gSystem->HomeDirectory(), gSystem->WorkingDirectory())) {
if (!gSystem->AccessPathName(name, kReadPermission))
Expand Down
4 changes: 1 addition & 3 deletions core/unix/src/TUnixSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1521,13 +1521,11 @@ const char *TUnixSystem::TempDirectory() const

FILE *TUnixSystem::TempFileName(TString &base, const char *dir, const char *suffix)
{
char *b = ConcatFileName(dir ? dir : TempDirectory(), base);
base = b;
PrependPathName(dir ? dir : TempDirectory(), base);
base += "XXXXXX";
const bool hasSuffix = suffix && *suffix;
if (hasSuffix)
base.Append(suffix);
delete [] b;

char *arg = StrDup(base);
int fd = hasSuffix ? mkstemps(arg, strlen(suffix)) : mkstemp(arg);
Expand Down
Loading
Loading