Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Using path to fully support windows #9

Open
Raynos opened this issue Dec 8, 2011 · 5 comments
Open

Using path to fully support windows #9

Raynos opened this issue Dec 8, 2011 · 5 comments

Comments

@Raynos
Copy link
Contributor

Raynos commented Dec 8, 2011

Code like ref

reqStr[0...2] is './' or reqStr[0...3] is '../'

will break in windows because of / vs \\.

One should favor using methods from path like path.relative

@clux
Copy link
Owner

clux commented Dec 9, 2011

Ah, yes, I remember thinking about that ages ago, then forgot. Thanks, will have a look at that again this weekend.

@clux
Copy link
Owner

clux commented Dec 12, 2011

Several path functions are very useful and have allowed me to cut down much of my own resolving code!

However, by introducing windows resolvability on the server, they will still fail on the client.
There are 2 (good) ways in which this can be solved that I see:

  • Regex replace all require strings on compilation with path.relative(domainPath, fullFilePath) by passing down resolver results to the bundler in its sorted list (can avoid adding something to require.js, however, debuggers will have to use current UNIX file string format when using with M8.require())
  • Fork path.js from node and try to make it work on the client (bloating app file, but could expose path functionality)

Currently undecided on what is the best way to proceed.

@Raynos
Copy link
Contributor Author

Raynos commented Dec 12, 2011

path has already been forked for the client by SubStack

@clux
Copy link
Owner

clux commented Jan 5, 2012

substack's fork is posix only. I might take the win32 bits from node and include it/posix version conditionally.
I'm not sure whether posix and windows slashes can coexist in the same codebase yet though. Surely they must, as npm modules are mostly posix, but if windows code use other slashes, and path determines slashtype by checking process.platform === 'win32', I am curious how anything will work at windows at all.

Anyway, been a bit busy over xmas, but things are making progress again.

@clux
Copy link
Owner

clux commented Jan 7, 2012

Using substack's posix fork now. Can write a w32 version and include it conditionally. But due to above reasons, not sure how to proceed yet, so I'm putting it on hold for 0.15.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants