Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite25d9a2

Browse files
committed
further fixes for windows
1 parente0a4381 commite25d9a2

File tree

9 files changed

+27
-7
lines changed

9 files changed

+27
-7
lines changed

‎lib/atom/editor.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ var exists_1 = require('../services/exists');
44
functionsetAtomGlobals(){
55
if(atom.project.rootDirectories.length>0){
66
window.coderoad.dir=atom.project.rootDirectories[0].path;
7+
if(navigator.appVersion.indexOf('Win')>-1){
8+
window.coderoad.win=true;
9+
}
710
}
811
else{
912
window.coderoad.dir=null;

‎lib/reducers/task-tests/concat-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22
varfs=require('fs');
33
functionconcatTests(targetFile,files){
4+
console.log('files',files);
45
if(fs.existsSync(targetFile)){
56
fs.unlink(targetFile);
67
}

‎lib/services/package.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ var Action = require('../actions/actions');
55
var_base_1=require('../_base');
66
var_=require('lodash');
77
functionconfigTestString(config,packageName,test){
8+
if(window.coderoad.win){
9+
test=test.split('/').join('\\');
10+
}
811
if(config.testDir){
912
test=path.join(window.coderoad.dir,'node_modules',packageName,config.testDir,test);
1013
}
@@ -45,7 +48,7 @@ var PackageService = (function () {
4548
return!tasks ?[] :tasks.map(function(task){
4649
if(task.tests){
4750
task.tests=task.tests.map(function(test){
48-
if(_.isString(test)&&task.tests.indexOf(test)===-1){
51+
if(_.isString(test)){
4952
returnconfigTestString(config,_this.packageName,test);
5053
}
5154
else{

‎lib/services/setGlobals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function loadRunnerDep(config) {
3030
console.log(message);
3131
throwmessage;
3232
}
33-
varslash=navigator.appVersion.indexOf('Win')!==-1 ?'\\' :'/';
33+
varslash=window.coderoad.win ?'\\' :'/';
3434
runnerMain=path.join.apply(null,runnerMain.split(slash));
3535
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf(slash));
3636
varpathToMain=path.join(runnerRoot,runnerMain);

‎src/atom/editor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import {fileExists} from '../services/exists';
44
exportfunctionsetAtomGlobals(){
55
if(atom.project.rootDirectories.length>0){
66
window.coderoad.dir=atom.project.rootDirectories[0].path;
7+
if(navigator.appVersion.indexOf('Win')>-1){
8+
window.coderoad.win=true;
9+
}
710
}else{
811
window.coderoad.dir=null;
912
}

‎src/reducers/task-tests/concat-tests.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
import*asfsfrom'fs';
22

33
exportfunctionconcatTests(targetFile:string,files:any):string{
4+
console.log('files',files);
45
// delete previous file
56
if(fs.existsSync(targetFile)){
67
fs.unlink(targetFile);
78
}
89

910
// load tests in order
10-
files.forEach((test:string)=>readAppend(targetFile,test));
11+
files.forEach((test:string)=>{
12+
// ensure loaded synchronously
13+
returnnewPromise((resolve,reject)=>{
14+
resolve(readAppend(targetFile,test));
15+
});
16+
});
1117
returntargetFile;
1218
}
1319

14-
functionreadAppend(targetFile:string,file:string):void{
20+
functionreadAppend(targetFile:string,file:string):boolean{
1521
try{
1622
letdata=fs.readFileSync(file,'utf8');
1723
fs.appendFileSync(targetFile,data,'utf8');
18-
return;
24+
returntrue;
1925
}catch(e){
2026
console.log('Error reading test file',e);
2127
}

‎src/services/package.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {store} from '../_base';
55
const_=require('lodash');
66

77
functionconfigTestString(config:CR.Config,packageName:string,test:string):string{
8+
if(window.coderoad.win){
9+
test=test.split('/').join('\\');
10+
}
811
if(config.testDir){
912
test=path.join(window.coderoad.dir,'node_modules',packageName,config.testDir,test);
1013
}else{
@@ -47,7 +50,7 @@ class PackageService {
4750
if(task.tests){
4851
task.tests=task.tests.map((test:string)=>{
4952
// add unique string to tests
50-
if(_.isString(test)&&task.tests.indexOf(test)===-1){
53+
if(_.isString(test)){
5154
returnconfigTestString(config,this.packageName,test);
5255
}else{
5356
console.error('Invalid task test',test);

‎src/services/setGlobals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function loadRunnerDep(config: PackageJson) {
3434
}
3535

3636
// fix main path for Windows
37-
letslash=navigator.appVersion.indexOf('Win')!==-1 ?'\\' :'/';
37+
letslash=window.coderoad.win ?'\\' :'/';
3838
runnerMain=path.join.apply(null,runnerMain.split(slash));
3939
// trim root path to folder
4040
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf(slash));

‎src/typings/cr/cr.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ declare namespace CR {
109109
edit?:boolean;
110110
runner?:any;
111111
taskPosition?:number;
112+
win?:boolean;
112113
}
113114

114115
interfaceConfig{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp