1
- const controller = require ( ' ../_controller' ) ;
1
+ const controller = require ( " ../_controller" ) ;
2
2
3
3
function TextStream ( filename ) {
4
- this . buffer = controller . readFile ( filename ) || '' ;
4
+ this . buffer = controller . readFile ( filename ) || "" ;
5
5
this . uuid = controller . getUUID ( ) ;
6
6
this . filename = filename ;
7
7
this . write = ( line ) => {
@@ -10,7 +10,7 @@ function TextStream(filename) {
10
10
controller . logResource ( this . uuid , this . filename , this . buffer ) ;
11
11
} ;
12
12
this . writeline = ( line ) => {
13
- this . buffer = this . buffer + line + '\n' ;
13
+ this . buffer = this . buffer + line + "\n" ;
14
14
controller . writeFile ( filename , this . buffer ) ;
15
15
controller . logResource ( this . uuid , this . filename , this . buffer ) ;
16
16
} ;
@@ -21,7 +21,7 @@ function TextStream(filename) {
21
21
this . bufferarray = [ ] ;
22
22
this . readline = function ( ) {
23
23
if ( this . bufferarray . length === 0 )
24
- this . bufferarray = this . buffer . split ( '\n' ) ;
24
+ this . bufferarray = this . buffer . split ( "\n" ) ;
25
25
return this . bufferarray . shift ( ) ;
26
26
} ;
27
27
this . shortpath = ( path ) => path ;
@@ -52,10 +52,10 @@ function Folder(path, autospawned) {
52
52
this . attributes = 16 ;
53
53
this . datelastmodified = new Date ( new Date ( ) - 15 * 60 * 1000 ) ; // Last changed: 15 minutes ago
54
54
this . files = [ ] ;
55
- this . name = ( path . replace ( / \w : / i, '' ) . match ( / \\ ( \w * ) (?: \\ ) ? $ / i) || [ null , '' ] ) [ 1 ] ,
55
+ this . name = ( path . replace ( / \w : / i, "" ) . match ( / \\ ( \w * ) (?: \\ ) ? $ / i) || [ null , "" ] ) [ 1 ] ,
56
56
this . path = path ;
57
- this . subfolders = autospawned ? [ ] : [ new ProxiedFolder ( path + ' \\RandomFolder' , true ) ] ;
58
- this . type = ' folder' ;
57
+ this . subfolders = autospawned ? [ ] : [ new ProxiedFolder ( path + " \\RandomFolder" , true ) ] ;
58
+ this . type = " folder" ;
59
59
}
60
60
61
61
function ProxiedFolder ( path , name , autospawned = false ) {
@@ -75,7 +75,7 @@ function ProxiedFolder(path, name, autospawned = false) {
75
75
76
76
function File ( contents ) {
77
77
this . openastextstream = ( ) => new ProxiedTextStream ( contents ) ;
78
- this . shortpath = ' C:\\PROGRA~1\\example-file.exe' ;
78
+ this . shortpath = " C:\\PROGRA~1\\example-file.exe" ;
79
79
this . size = Infinity ;
80
80
this . attributes = 32 ;
81
81
}
@@ -120,47 +120,47 @@ function ProxiedDrive(name) {
120
120
121
121
function FileSystemObject ( ) {
122
122
this . createtextfile = this . opentextfile = ( filename ) => new ProxiedTextStream ( filename ) ;
123
- this . buildpath = ( ...args ) => args . join ( '\\' ) ;
123
+ this . buildpath = ( ...args ) => args . join ( "\\" ) ;
124
124
this . fileexists = this . deletefile = ( ) => {
125
- const value = process . argv . indexOf ( ' --no-file-exists' ) === - 1 ;
125
+ const value = process . argv . indexOf ( " --no-file-exists" ) === - 1 ;
126
126
if ( value ) {
127
- console . log ( ' Returning `true` for FileSystemObject.FileExists; use --no-file-exists if nothing happens' ) ;
127
+ console . log ( " Returning `true` for FileSystemObject.FileExists; use --no-file-exists if nothing happens" ) ;
128
128
}
129
129
return value ;
130
130
} ;
131
131
this . getfile = ( filename ) => new ProxiedFile ( filename ) ;
132
132
this . getspecialfolder = function ( id ) {
133
133
switch ( id ) {
134
134
case 0 :
135
- case '0' :
136
- return ' C:\\WINDOWS\\' ;
135
+ case "0" :
136
+ return " C:\\WINDOWS\\" ;
137
137
case 1 :
138
- case '1' :
139
- return ' (System folder)' ;
138
+ case "1" :
139
+ return " (System folder)" ;
140
140
case 2 :
141
- case '2' :
142
- return ' (Temporary folder)' ;
141
+ case "2" :
142
+ return " (Temporary folder)" ;
143
143
default :
144
- return ' (Special folder ' + id + ')' ;
144
+ return " (Special folder " + id + ")" ;
145
145
}
146
146
} ;
147
- this . gettempname = ( ) => ' (Temporary file)' ;
148
- this . createfolder = ( folder ) => ' (Temporary new folder)' ;
147
+ this . gettempname = ( ) => " (Temporary file)" ;
148
+ this . createfolder = ( folder ) => " (Temporary new folder)" ;
149
149
this . folderexists = ( folder ) => {
150
150
const defaultValue = true ;
151
151
console . log ( `Checking if ${ folder } exists, returning ${ defaultValue } ` ) ;
152
152
return defaultValue ;
153
153
} ;
154
154
this . getfolder = ( str ) => new ProxiedFolder ( str ) ;
155
- this . getfileversion = ( ) => '' ;
156
- this . drives = [ new ProxiedDrive ( 'C:' ) ] ;
155
+ this . getfileversion = ( ) => "" ;
156
+ this . drives = [ new ProxiedDrive ( "C:" ) ] ;
157
157
this . getdrive = ( drive ) => new ProxiedDrive ( drive ) ;
158
- this . getdrivename = path => {
158
+ this . getdrivename = ( path ) => {
159
159
const matches = path . match ( / ^ \w : / ) ;
160
160
if ( matches == null )
161
161
return "" ;
162
162
return matches [ 0 ] ;
163
- }
163
+ } ;
164
164
}
165
165
166
166
module . exports = function ( ) {
0 commit comments