Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Mon Dec 10, 2007 2:47 am   

#write and my ignorance
 
OS:Vista

I'm still at a bit of a loss with the intended versus actual functionality of the #file and #write commands. First question, where should one be able to write to? Some have said only the character subfolder. For me that would be my games/foxmud. But zuggs release notes seem to indicate one should be able to write to anywhere on the hard drive.
Quote:
The #FILE command now creates files within the character subfolder (the folder that contains the primary package file) by default.
The #FILE command now allows relative and absolute paths to be specified for filenames


Second, I've been playing around a bit with absolute and relative paths, trying to figure out my own answer for my question above. My character folder is C:\Users\Administrator\Documents\My Games\CMUD\FoxMud.
So my first test is trying to write to this folder using an absolute path:
Code:
#file 2 "C:\Users\Administrator\documents\my games\cmud\foxmud\writingtestfile6933.txt"
this works, it writes the file and has an output of :
Code:
Opened writingtestfile6933.txt as file 2
Closed C:\Users\Administrator\documents\my games\cmud\foxmud\writingtestfile6933.txt on file 2

This appears to do what it should.
Next test is trying to write to a new directory within this folder using an absolute path:
Code:
file 2 "C:\Users\Administrator\documents\my games\cmud\foxmud\newtestfolder\writingtestfile6933.txt"
yeilds an output of
Code:
Opened newtestfolder\writingtestfile6933.txt as file 2
Closed C:\Users\Administrator\documents\my games\cmud\foxmud\newtestfolder\writingtestfile6933.txt on file 2
but does not create a new folder called newtestfolder and does not write the file to either of the directories. I'm not sure if this is the intended function, or if the #write or #file command should create a new subdirectory when one is specified if none exists. It'd be nice if it did.
Third test, trying to write to a directory outside of my character directory using an absolute path:
Code:
#file 2 "C:\Users\Administrator\documents\writingtestfile69879.txt"
gives an output of
Code:
Opened writingtestfile69879.txt as file 2
Closed C:\Users\Administrator\Documents\My Games\CMUD\FoxMud\writingtestfile69879.txt on file 2
This does write the file to the character folder being foxmud as the outputs opened and closed suggest. However if it is intended to be able to write to a folder outside of the character folder using an absolute path, it doesn't look like it works. I've also tried it without quotes and reversing the slashes but neither of these help.

Next, using relative paths:
first, just specifying a file name writes correctly to the character folder there. however if you put a new folder in the #file command, as with absolute paths, it won't create the folder. again, I don't know if it should or not, and either way not a big deal for me if it doesn't. If you specify a pre existing folder within the character folder, it will write to it, as intended.
Lastly, writing to a folder outside of the character folder or in my case higher than the foxmud folder.
Code:
#file 2 "..\..\writingtestfile698795.txt"
yields
Code:
Opened ..\..\writingtestfile698795.txt as file 2
Closed C:\Users\Administrator\Documents\My Games\CMUD\FoxMud\..\..\writingtestfile698795.txt on file 2
which should have written to the my games folder which it did. This works as far up as the root of c:. It looks to me like the absolute path will write to any folder on the drive, however I would have thought the closed output would have shown
Code:
C:\Users\Administrator\Documents\My Games\writingtestfile698795.txt
rather than
Code:
C:\Users\Administrator\Documents\My Games\CMUD\FoxMud\..\..\writingtestfile698795.txt

In a nutshell it looks to me like the intent is to be able to write to any location on the hard drive, as this is how the relative paths work. However, absolute paths dont appear to function this way, as they can't write to any location outside of the character folder. Lastly the closed output for relative paths might be tweaked a bit to get rid of the cmud\foxmud\..\.. parts.

Again, sorry if this has been covered elsewhere.

As an addition to this, it looks like #log creates the log file in the program files\cmud directory. The creation of this file in this directory by default seems to be out of sync with the #file default being a different directory. I wouldn't mind seeing the default location for #log files to be the same as for #file files. Also, I use #launch to launch text files and batch files that I create with cmud. Because these files are now created in the my games/foxmud directory rather than the program files/cmud directory, when using the #launch command I have to specify c:\users\administrator\documents\my games\foxmud\*.* to launch a file. Since these files are now by default created in this folder, I'd like to see #launch changed to have a default location that matches the character as with #file and my suggestion above about #log.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Dec 11, 2007 5:51 pm   
 
First, this all depends upon the version of CMUD you are using. The changes allowing #FILE to work with absolute paths was added in one of the CMUD BETA versions, so this post should really be in the CMUD Beta Forum. The v1.34 Public release still restricts the #FILE command to the current CMUD directory.

So please try to post questions about the Beta version to the Beta forum in the future. Otherwise people in the regular forum will try to test your post with the latest public version and get different results.

The #FILE command will never create a new subdirectory. You must create the appropriate subdirectories yourself within Windows.

The latest Beta version of CMUD is supposed to allow absolute and relative paths, so the issues you mention look like bugs in the latest Beta version (which is the other reason I am moving this post to the Beta forum).
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Dec 12, 2007 12:27 am   
 
OK, this is fixed for 2.17. Absolute paths now work. It still won't create new directories though. And the display oddity with the relative path still showing ../.. in #CLOSE is still there (since it doesn't effect the functionality).

I updated #LOG to use the same routine to use the character folder by default. I also changed #LAUNCH to look for the file in the character folder first, and if found, execute it from there. Otherwise it works as normal so that it allows Windows to look in the Windows directory for application files.
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Wed Dec 12, 2007 1:30 am   
 
Cool. Thanks for the response and action! Sorry about posting in the release forum instead of the beta forum. Embarassed
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Dec 16, 2007 6:16 am   
 
I'm still having trouble with #launch a bit. I'm using it to launch a .bat file and I've tried all of the ways I can think of to script the path name to fire it out of the my games\cmud\foxmud directory, but I just can't get it to work. However, if I do
Code:
#launch cmd.exe
a dos window pops up pointed to c:\program files\cmud>
Also, if I place the EQFolderListing.bat file in the program files\cmud directory and use
Code:
#launch "EQFolderListing.bat"
it fires the .bat file from this location. I can also create a subdirectory in this cmud directory, move the .bat file to it, use
Code:
#launch "testdir\EQFolderListing.bat"
it also fires correctly.

If I use change the fiel from a .bat to a .txt file and use
Code:
#launch {notepad.exe C:\Users\Administrator\Documents\"My Games"\CMUD\FoxMud\"Permanent Batch Files"\"EQ Folder Listing"\EQFolderListing.txt}
the file opens in notepad as it should.

Lastly, if I use
Code:
#launch "notepad.exe tester.exe"
where tester.exe is located at C:\Users\Administrator\Documents\My Games\CMUD\FoxMud\tester.txt, I get a message saying cannot find the file.

It looks like #launch isn't searching the character file (cmud\foxmud) in my case for the file as a default as zugg indicated it would in my last post about #write. It also looks like it's having trouble opening a .bat file ouside of the program files directory. I'm using Vista
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net