Permalink
Browse files

Fixes #57 xpcshell: windows FileUtils.File does not like / paths

  • Loading branch information...
1 parent 712f2d8 commit 9ce270089ae03c9c63552f0a53898982c6436eeb @jrburke jrburke committed Jul 19, 2013
Showing with 12 additions and 6 deletions.
  1. +12 −6 text.js
View
18 text.js
@@ -1,5 +1,5 @@
/**
- * @license RequireJS text 2.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * @license RequireJS text 2.0.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/requirejs/text for details
*/
@@ -11,7 +11,7 @@
define(['module'], function (module) {
'use strict';
- var text, fs, Cc, Ci,
+ var text, fs, Cc, Ci, xpcIsWindows,
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
@@ -23,7 +23,7 @@ define(['module'], function (module) {
masterConfig = (module.config && module.config()) || {};
text = {
- version: '2.0.7',
+ version: '2.0.8',
strip: function (content) {
//Strips <?xml ...?> declarations so that external SVG and XML
@@ -343,11 +343,17 @@ define(['module'], function (module) {
Cc = Components.classes,
Ci = Components.interfaces;
Components.utils['import']('resource://gre/modules/FileUtils.jsm');
+ xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc);
text.get = function (url, callback) {
- var inStream, convertStream,
- readData = {},
- fileObj = new FileUtils.File(url);
+ var inStream, convertStream, fileObj,
+ readData = {};
+
+ if (xpcIsWindows) {
+ url = url.replace(/\//g, '\\');
+ }
+
+ fileObj = new FileUtils.File(url);
//XPCOM, you so crazy
try {

0 comments on commit 9ce2700

Please sign in to comment.