The issue is this:
The first time a new File object is assigned to a variable (say 'f') after script compilation, f.filename returns the file name by itself.
Assigning a new file to the same variable again without recompiling will cause f.filename to return the entire absolute path to the file. Check out the attached patcher to replicate the problem. Enlightenment is very welcome.
For convenience, here's the js code-
var patcherDir = this.patcher.filepath.replace(patcher.name+".maxpat", "");
var awesomeFile = new File(patcherDir+"asauce.txt", "readwrite", ["TEXT"]);
awesomeFile.writeline("I am the most awesome file");
post("filename: " + "asauce.txt");
post("File.filename: " + awesomeFile.filename);