@@ -270,9 +270,13 @@ static void SignAddHandler(Player player, CommandReader cmd)
270270 }
271271 else
272272 {
273- if ( ! Directory . Exists ( "./Signs/" ) ) Directory . CreateDirectory ( "./Signs/" ) ;
274- if ( ! Directory . Exists ( "./Signs/" + player . World . Name + "/" ) ) Directory . CreateDirectory ( "./Signs/" + player . World . Name + "/" ) ;
275- File . WriteAllText ( "./Signs/" + player . World . Name + "/" + newZone . Name + ".txt" , cmd . NextAll ( ) ) ;
273+ string path = Paths . SignsPath ;
274+ if ( ! Directory . Exists ( path ) ) Directory . CreateDirectory ( path ) ;
275+ path = Path . Combine ( path , player . World . Name ) ;
276+ if ( ! Directory . Exists ( path ) ) Directory . CreateDirectory ( path ) ;
277+
278+ path = Path . Combine ( path , newZone . Name + ".txt" ) ;
279+ File . WriteAllText ( path , newZone . Sign ) ;
276280 player . Message ( "Message for sign {0}&S is: {1}" , newZone . ClassyName , newZone . Sign ) ;
277281 newZone . Sign = null ;
278282 }
@@ -369,27 +373,26 @@ static void ZoneEditHandler( Player player, CommandReader cmd ) {
369373
370374 //player.Message(cmd.RawMessage);
371375 //player.Message(cmd.RawMessage.Substring(cmd.Offset));
372- if ( cmd . RawMessage . Substring ( cmd . Offset + 1 ) . StartsWith ( "#" ) )
373- {
374- zone . Sign = cmd . NextAll ( ) . Substring ( 1 ) ;
375- if ( zone . Sign . Length == 0 || zone . Sign == null )
376- {
377- if ( ! Directory . Exists ( "./Signs/" ) ) Directory . CreateDirectory ( "./Signs/" ) ;
378- if ( ! Directory . Exists ( "./Signs/" + player . World . Name + "/" ) ) Directory . CreateDirectory ( "./Signs/" + player . World . Name + "/" ) ;
379- if ( File . Exists ( "./Signs/" + player . World . Name + "/" + zone . Name + ".txt" ) ) File . Delete ( "./Signs/" + player . World . Name + "/" + zone . Name + ".txt" ) ;
380- player . Message ( "Sign Text for zone {0}&S was removed." , zone . ClassyName ) ;
381- zone . Sign = null ;
382- }
383- else
384- {
385- if ( ! Directory . Exists ( "./Signs/" ) ) Directory . CreateDirectory ( "./Signs/" ) ;
386- if ( ! Directory . Exists ( "./Signs/" + player . World . Name + "/" ) ) Directory . CreateDirectory ( "./Signs/" + player . World . Name + "/" ) ;
387- File . WriteAllText ( "./Signs/" + player . World . Name + "/" + zone . Name + ".txt" , cmd . NextAll ( ) . Substring ( 1 ) ) ;
388- player . Message ( "Sign Text for zone {0}&S changed to {1}" , zone . ClassyName , zone . Sign ) ;
389- zone . Sign = null ;
390- }
391- return ;
376+ if ( cmd . RawMessage . Substring ( cmd . Offset + 1 ) . StartsWith ( "#" ) ) {
377+ zone . Sign = cmd . NextAll ( ) . Substring ( 1 ) ;
378+
379+ string path = Paths . SignsPath ;
380+ if ( ! Directory . Exists ( path ) ) Directory . CreateDirectory ( path ) ;
381+ path = Path . Combine ( path , player . World . Name ) ;
382+ if ( ! Directory . Exists ( path ) ) Directory . CreateDirectory ( path ) ;
383+
384+ path = Path . Combine ( path , zone . Name + ".txt" ) ;
385+ if ( zone . Sign . Length == 0 || zone . Sign == null ) {
386+ if ( File . Exists ( path ) ) File . Delete ( path ) ;
387+ player . Message ( "Sign Text for zone {0}&S was removed." , zone . ClassyName ) ;
388+ zone . Sign = null ;
389+ } else {
390+ File . WriteAllText ( path , zone . Sign ) ;
391+ player . Message ( "Sign Text for zone {0}&S changed to {1}" , zone . ClassyName , zone . Sign ) ;
392+ zone . Sign = null ;
392393 }
394+ return ;
395+ }
393396
394397 string nextToken ;
395398 while ( ( nextToken = cmd . Next ( ) ) != null ) {
0 commit comments