RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Filenames with spaces

0 Members and 2 Guests are viewing this topic.

**
Rep: +0/-0Level 85
Am I correct in assuming RMXP doesn't work well with filenames with spaces?  Fir example, FileText.exist?() is returning false to me on a file I know for a fact exists, and RPG::Cache.picture() is also generating an error with that same file.  Is there anyway to get it to recognize a filename with a space in it?

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Couldn't you just remove the space?

There is a way though, check the Scene_Save and Load methods until you find how it reads the save files, I believe the save files have a space in them, so just look through those methods and you'll find it.

**
Rep: +0/-0Level 85
Unfortunately, for what I'm attempting, no I cannot remove the space... But either way, I'll look into the save system...

thanx


[EDIT]
Unfortunately, nothing helpful in the save and load game scripts...  They use FileTest.exist?() as well, so I assume a save game with a space in it would fail too...
« Last Edit: June 14, 2008, 03:15:12 PM by wizaerd »

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Search around ruby websites, you just need to find the encoding for a space, I think its %20 or something like that, but I don't know for sure, so just search around.

*
Resident Cloud
Rep:
Level 91
i try to convice people everday that spaces cause problems :(. i spend about 2 hours every few months fixing friends IT school work. :(

just out of intrest why cant you remove the space ?

**
Rep: +0/-0Level 85
Because the script I was writing at the time was relying upon the character's name to look for an associated image file.  The character's name at the time was made up of two names, so it wouldn't work.  But I worked around it with a bit of a kludge.

In this day and age, filenames with spaces in themare quite common, and don't (or shouldn't) cause the problems they did 5 or even 10 years ago.  I work as a professional software developer (C#), and always take into consideration that filenames may have space in them.

*
Resident Cloud
Rep:
Level 91

Code: [Select]
String firstName = "Fred";
  String lastName  = "Flinstone";
  String fullName  = firstName + lastName;
  file = fullName + ".png"

...

**
Rep: +0/-0Level 85

Code: [Select]
String firstName = "Fred";
  String lastName  = "Flinstone";
  String fullName  = firstName + lastName;
  file = fullName + ".png"

...

Nope, wouldn't have worked.  But as I said, it's a moot point, I already resolved it...  But thanx

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
If it's only because of the name having spaces you could just replace the spaces with something else like _
Here is an example of text substitution:
Code: [Select]
name =  "Fred Flintstone"
new_name = name.gsub(/ /, '_')


Now I see you have resolved it.
Could you share your solution? You know, in case someone else comes into the same situation.

*hugs*
 - Zeriab

*
Resident Cloud
Rep:
Level 91
:D that would also work.

**
Rep: +0/-0Level 85
If it's only because of the name having spaces you could just replace the spaces with something else like _
Here is an example of text substitution:
Code: [Select]
name =  "Fred Flintstone"
new_name = name.gsub(/ /, '_')


Now I see you have resolved it.
Could you share your solution? You know, in case someone else comes into the same situation.

*hugs*
 - Zeriab

Yup, the string replacement was the answer. So now in my script I pull the name of the actor as usual, but automatically do a string replacement on the chance there's a space in it.  This way there's no hard coded image names and works for any actor/character.