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

Commit

Permalink
Merge pull request #1002 from spmjs/node_0_11
Browse files Browse the repository at this point in the history
fix isroot testcase for node 0.11
  • Loading branch information
sorrycc committed Sep 11, 2014
2 parents 78415cf + 412a2d3 commit 6de2171
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/sdk/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ var log = require('../utils/log');

var file = module.exports = {};

file.isroot = function(str) {
if (process.platform === 'win32') {
file.isroot = function(str, platform) {
if ((platform || process.platform) === 'win32') {
return path.normalize(str).slice(1, 3) === ':\\';
} else {
return str.charAt(0) === '/';
Expand Down
5 changes: 2 additions & 3 deletions tests/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ describe('file', function() {
it('isroot', function() {
file.isroot('/').should.eql(true);
var oldPlatform = process.platform;
process.platform = 'win32';
file.isroot('C:\\').should.eql(true);
file.isroot('D:\\').should.eql(true);
file.isroot('C:\\', 'win32').should.eql(true);
file.isroot('D:\\', 'win32').should.eql(true);
process.platform = oldPlatform;
});

Expand Down

0 comments on commit 6de2171

Please sign in to comment.