• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Using //! import with "relative" file paths

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

So suppose I have some uniquely named directory foo which always has my file bar.j (my map's script).

Now AFAIK, I need to supply the absolute path to //! import, otherwise it won't find my map script bar.j

JASS:
//! import "C:/users/me/desktop/foo/bar.j"

Now that's fine and dandy, but it's kind of ugly for a number of reasons. I've listed two off the top of my head.

1. It's specific to a user/a filesystem

2. anyone else who wants to work on the script or test the map needs to put bar.j in the same space

So instead if we know the folder and filename is unique irrespective of filesystem or OS, couldn't the import simply be something like

JASS:
//! import "foo/bar.j"

And then behind the scenes it searches from the root of the entire filesystem and works its way down (depth first search if you'd like). Eventually it will run into some folder call "foo" and hopefully it has a file called "bar.j" inside it.

Now why doesn't it do this--doing the depth first search is trivial AFAIK.
 
Last edited:
Status
Not open for further replies.
Top