Assigning eg file("foo/bar.txt") to world.log then writing to world.log will not create 'foo/bar.txt' if the folder 'foo' does not already exist.
Numbered Steps to Reproduce Problem:
1. Assign world.log to file("folder/file.txt") where 'folder' does not exist
2. Write to world.log via <<
3. Observe lack of 'folder/file.txt'
Code Snippet (if applicable) to Reproduce Problem:
/world/New()
log = file("foo/bar.txt") // folder 'foo' does not exist
log << "bar" // does *not* create 'foo/bar.txt'
// If you write before assigning, the file is created correctly,
// and future output to world.log is written as expected:
var/new_log = file("bar/foo.txt")
new_log << "something"
log = new_log
log << "foo" // written to 'bar/foo.txt'
Expected Results:
Assigning a file in a non-existent folder to world.log then writing to it would create the folder.
Actual Results:
It did not create the folder or write to file.
Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes.
In other user accounts? Yes.
On other computers? Yes.
When does the problem NOT occur? When you write to the file prior to assigning it to world.log
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown
Workarounds: Write to the file before assigning it to world.log
world.log can't create new directories, only write to existing ones.
Numbered Steps to Reproduce Problem:
1) Set world.log to something like "logs/log.txt"
2) Make sure the "logs" directory doesn't exit.
3) Find that world.log acts as if it's not set to a file.
4) Create the "logs" directory.
5) Find the world.log works as expected.
Code Snippet (if applicable) to Reproduce Problem:
world.log = "logs/log.txt"
Expected Results:
It to create the "logs" directory like every other file I/O operation does.
Actual Results:
world.log outputs to O&M (and the default output control) as if it's not pointing at a valid file. No file is created.
Does the problem occur:
Every time? Or how often? Every time.
In other games? Assume so
In other user accounts? Yes
On other computers? Yes
When does the problem NOT occur?
When creating the directory before writing to world.log.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I'm pretty sure it would have been reported already if it was happening in older versions, but I can't really test it.
Workarounds:
Use text2file() to write to world.log first.
text2file("Beginning log",world.log)