July 4th, 2013, 11:24 PM
Join Date: Feb 2012
Time spent in forums: 1 Day 28 m 24 sec
Reputation Power: 2
Well, I didn't get an exact solution as to what I mentioned above. However, I did come up with a compromise. As long as the files are located in the root or sub directory of the root server, then this code will work.
scriptDir = os.getcwd();
pathArr = ;
for directory in path.split('/'):
if '.' in pathArr[len(pathArr)-1]:
path = '';
for index in range(0,len(pathArr)):
if pathArr[index] not in scriptDir:
path = path + '/' + pathArr[index];
return os.path.normpath(scriptDir + path);
abspath = getAbsolutePath(path);
then I attach the filename and extension to it at a later time :)
path = os.path.normpath(abspath + '/' + fileName + '.' + extension);
I get the absolute path (file not included in path) and make that my working directory. That way I can just call the working directory to build the absolute path to the file.
Last edited by Cameron0960 : July 4th, 2013 at 11:26 PM.