ID:100987
 
Resolved
winget() was interpreting single-value results incorrectly, acting as if text was in an escaped form.
BYOND Version:474
Operating System:Windows XP Pro
Web Browser:Firefox 3.6.8
Applies to:Dream Seeker
Status: Resolved (475)

This issue has been resolved.
Descriptive Problem Summary:
If the user inputs the following into ImageInput...
c:\myproject\tibby.png


and hits a submit button where we execute this line.
var/filePath = winget(usr, "ImageInput", "text");


We end up getting this...
c:\myproject    ibby.png


Expected Results:
My expectation is that getting a file path from a user should be trivial.

Actual Results:
Lots of head banging on keyboard and still no usable file path.

Workarounds:
None so far. I've tried all the usual methods.

You could search for tabs and replace them with \t for now.
Falacy wrote:
You could search for tabs and replace them with \t for now.

Yeah, but what other escaped characters do I have to look for? There's newline (\n), backspace (\c), and etc.
In a cheapo test I ran \t seems to be the only one broken when using winget().
While testing last night, \n causes problems as well so I assumed that there would be others.
Maybe, I thought that was just because I was winset()ing it first, but apparently not. Anyway, these seem to just be BYOND outputs auto formatting things, if you actually try to load a file with that path it should still work.
Falacy wrote:
Maybe, I thought that was just because I was winset()ing it first, but apparently not. Anyway, these seem to just be BYOND outputs auto formatting things, if you actually try to load a file with that path it should still work.

I actually needed to save the actual path. Getting the file isn't a problem. :) I've come up with a suitable workaround (design change) although, knowing how to get a proper path would still be useful.
The problem is that because winget converts "\t" to a tab, if the returned string contains a tab you have no way to know if it was because the user typed in the string "\t" or because they typed a tab.

In this case a workaround exists, but no workaround seems to exist for the problem as a whole.
Forum_account wrote:
The problem is that because winget converts "\t" to a tab, if the returned string contains a tab you have no way to know if it was because the user typed in the string "\t" or because they typed a tab.

In this case a workaround exists, but no workaround seems to exist for the problem as a whole.

I don't think you can "type" a tab into an input can you? BYOND just moves tab focus to the next button control or the parent window (I think).
You can always paste text that contains a tab.
Indeed. Attempts to check for \t vs an actual tab return the same.