oh.. Got your problem now... You should create a new think for this ent that takes care of moving these files around. You can schedule the think when you want. So this will give you a chance for the demo to write. Also, you can set it up to call itself if the write fails (ie it's not ready to write yet).
--- On Wed, 11/18/09, Klaus Müller <[email protected]> wrote: > From: Klaus Müller <[email protected]> > Subject: Re: [hlcoders] Change default demo directory and move demos after > creation > To: "Discussion of Half-Life Programming" <[email protected]> > Date: Wednesday, November 18, 2009, 2:11 PM > Right now I'm just using the rename > from stdio.h. There is a way to move > files using Valve's filesystem. The problem is that you > can't call the > rename function right after you issued the server cmd to > stop the demo cause > it takes some time until the demo is created, hence the > file is in use and > rename() will fail. > > 2009/11/18 Tony Paloma <[email protected]> > > > Uh, wait. If you're just moving a file, why would you > use "system" and not > > the rename function from stdio.h. > > > > Also, I'm pretty sure valve's filesystem interface > provides a move > > function. > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] > On Behalf Of Grash > > Sent: Wednesday, November 18, 2009 8:47 AM > > To: Discussion of Half-Life Programming > > Subject: Re: [hlcoders] Change default demo directory > and move demos after > > creation > > > > I feel real dirty suggesting this. But it's how I'd go > about doing it > > myself... > > > > you can use system() [or _wsystem()] > > http://msdn.microsoft.com/en-us/library/aa273022%28VS.60%29.aspx > > > > http://www.cplusplus.com/reference/clibrary/cstdlib/system/ > > This describes as the function taking over the program > till the command > > finishes. Given we're talking about disk operation, > and that's slow as shit > > to perform this could be a concern! > > > > Is there a safer method in the source engine? > > > > --- On Tue, 11/17/09, N K <[email protected]> > wrote: > > > > > From: N K <[email protected]> > > > Subject: Re: [hlcoders] Change default demo > directory and move demos > > after > > creation > > > To: "Discussion of Half-Life Programming" > > <[email protected]> > > > Date: Tuesday, November 17, 2009, 3:30 PM > > > Well, that's embarrassing. I know I > > > tried to record to another directory by > > > using record "bla/temp.dem" and for some reason > it didn't > > > work. Now I > > > realise it does work so I must have messed up > with the > > > syntax when I tested > > > it before. So okay, one problem solved; one to > go... and > > > the renaming thing > > > is actually the more important one. > > > > > > 2009/11/17 Spencer 'voogru' MacDonald <[email protected]> > > > > > > > Why not just record the demo to where it > will end up > > > anyway and skip the > > > > whole moving part? > > > > > > > > With SourceTV you can change the demo path > by simply > > > doing like tv_record > > > > "path/to/demo.dem", probably the same with > the > > > standard record command. > > > > > > > > -----Original Message----- > > > > From: [email protected] > > > > [mailto:[email protected]] > > > On Behalf Of N K > > > > Sent: Tuesday, November 17, 2009 2:06 PM > > > > To: [email protected] > > > > Subject: [hlcoders] Change default demo > directory and > > > move demos after > > > > creation > > > > > > > > Hello everyone. I've got two rather special > questions > > > which I doubt have > > > > been asked before. I'm guessing that's also > why I > > > haven't been able to find > > > > anything about it on the internet so far. > > > > > > > > First of, I'm working with the OB version of > the SDK. > > > I've added a custom > > > > trigger to triggers.cpp that is supposed to > start and > > > stop a demo when the > > > > player touches it. That's where my first > question > > > comes up. I'm recording > > > > the demo to a temporary file that I want to > rename and > > > move after it's > > > > fully > > > > recorded. For that purpose I'd like to save > the > > > temporary demo in another > > > > folder than the root dir of my mod in > /sourcemods (say > > > in > > > > /sourcemods/mymod/temp). Is that possible > somehow or > > > is it not in the hands > > > > of modders? I have not been able to find > anything > > > about it in the source > > > > code the SDK provides so I'm getting the > feeling it's > > > not. > > > > > > > > Secondly, once the demo is stopped, I want > to rename > > > it after a certain > > > > scheme and then move it out of it's > temporary folder > > > (respectively the root > > > > dir if I can't change that). The problem is > that it > > > takes a certain time > > > > until the demo is stopped. Right now, > touching the > > > stopping trigger calls > > > > the Touch( CBaseEntity *pOther ) method from > where it > > > issues the following > > > > two commands: > > > > > > > > engine->ServerCommand( "stop\n" ); > > > > pPlayer->MoveDemo( pPlayer ); > > > > > > > > I've implemented the MoveDemo method in > > > basecombatcharacter.cpp cause I > > > > need > > > > to access player specific variables I added > to the > > > class. Now my question > > > > is > > > > simply how I could work around this problem, > meaning > > > how could I make sure > > > > the MoveDemo function gets called when I can > be sure > > > that the demo isn't > > > > used by the application anymore. > > > > > > > > In that context I just thought of another > question > > > that's of similar > > > > nature. > > > > I don't want to stop the demo at the exact > moment the > > > player touches the > > > > trigger. I'd rather have a little time > difference of > > > say 6+ seconds so the > > > > demo doesn't stop so abruptly. > > > > > > > > I'm really happy about any input from you > guys cause > > > I'm completely stuck > > > > because of these problems right now. Thank > you. > > > > > _______________________________________________ > > > > To unsubscribe, edit your list preferences, > or view > > > the list archives, > > > > please visit: > > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > > > > > _______________________________________________ > > > > To unsubscribe, edit your list preferences, > or view > > > the list archives, > > > > please visit: > > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or > view the > > > list archives, please visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > > > > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view > the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view > the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the > list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

