mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
use Java's File/URI classes to convert between paths and URIs (#203)
This commit is contained in:
parent
0fdcdd0794
commit
46959b53a1
18
jsdoc.js
18
jsdoc.js
@ -198,7 +198,6 @@ function main() {
|
||||
},
|
||||
resolver,
|
||||
fs = require('fs'),
|
||||
os = require('os'),
|
||||
path = require('path'),
|
||||
Config = require('jsdoc/config');
|
||||
|
||||
@ -230,14 +229,7 @@ function main() {
|
||||
scheme;
|
||||
|
||||
if (env.vm === 'rhino') {
|
||||
result = result.replace(/\\/g, '/').replace(/ /g, '%20');
|
||||
|
||||
scheme = 'file:';
|
||||
if ( os.platform() === 'win32' ) {
|
||||
scheme += '/';
|
||||
}
|
||||
|
||||
result = scheme + result;
|
||||
result = new java.io.File(result).toURI() + '';
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -254,13 +246,7 @@ function main() {
|
||||
scheme;
|
||||
|
||||
if (env.vm === 'rhino') {
|
||||
result = result.replace(/%20/g, ' ');
|
||||
|
||||
scheme = 'file:';
|
||||
if ( os.platform() === 'win32' ) {
|
||||
scheme += '/';
|
||||
}
|
||||
result = result.replace( new RegExp('^' + scheme), '' );
|
||||
result = new java.io.File( new java.net.URI(result) ) + '';
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Emulate the Node.js `os` module.
|
||||
* @see http://nodejs.org/api/os.html
|
||||
*/
|
||||
exports.platform = function() {
|
||||
var osname = java.lang.System.getProperty("os.name").toLowerCase() + '';
|
||||
|
||||
// obviously this isn't right, but we probably just need to distinguish between Windows/Cygwin/
|
||||
// MinGW and everything else
|
||||
if ( osname.indexOf('windows') !== -1 ) {
|
||||
return 'win32';
|
||||
} else {
|
||||
return 'linux';
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user