Think of something that you wish Authorware could do but it doesn't?
Let the our good friends at Macromedia know via the wishlist.
Please let us know if you find
any of the materials on this site inappropriate or offensive. Please include
the url and why the material should be reviewed.
Comments and questions about the site are also welcome. Please no Authorware
questions, use the AWARE
There are 0 reviews
B5015 - Why are my file path names not working! [The dangers of backslashes!]
by - Joseph Ganci
Does anyone know why
both return the contents of "infoList.txt". However, if I create my own training_data directory
no value is returned?
AH-HA! Count yourself as the latest victim of the double-backslash beast!
This drove my officemate nuts once for quite a while until I pointed out the
error of his ways.
Here's what the problem is:
The backslash character is an escape character in Authorware. This means
that what follows the backslash is important. If you follow it with an "r"
for instance, \r, this means a return character, so that if var was:
var := "Joe\ris great."
showing var on the screen would show:
var := "Joe\ris\treally great!"
will get you:
is really great!
What!?! The \t counts as a tab character in Authorware.
Now there are a handful of characters that can combine with the backslash to
make an escape character, but most don't, and in those cases the backslash
is counted as a normal backslash. See where this is headed? That's the case
in your line:
The letters w, a, and i don't combine with a \ to make an escape character,
so the line works as is.
BUT (and this is a really big BUT)
has a letter t after the backslash, making it a Tab character. You can now
see it like this:
Oops! If you had chosen a directory name that didn't start with a t, r, or n
(and a couple of other characters) you would have been fine.
So how do you get a freaking backslash character to stay put? Use a second
backslash: \\. This gets interpreted in Authorware as one backslash.
The ultimate solution? In file paths, always use two backslashes where one
will normally go:
will be interpreted as:
Oh, and you know those UNC network drives that start with two backlashes
Well you would need to write that as:
A quick experiment will bear this out. Try typing in a Calc icon:
var := "c:\myfolder\tmyfile.txt"
Close the Calc, then reopen it. You will now see:
var := "c:\\myfolder\tmyfile.txt"
Notice that Authorware saw that the first backslash could not combine with
an m to be an escape character, so it added a second backslash for you for
good measure. On the second backslash combination, though, it saw that \t
could be a legimimate escape sequence, so it didn't change that one. Tricky,
Tom Adams added:
You might want to mention that what you describe is case-sensitive. AW
adds the 2nd backslash IF it sees \T. As you stated, it does not if it sees
Add your review