Created
May 1, 2019 18:18
-
-
Save arakov/8b73230c84f12a222447b4efa2dc2520 to your computer and use it in GitHub Desktop.
scanning folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import extensions; | |
import system'io; | |
import system'routines; | |
public vmToAsm(var s) | |
{ | |
int pos := s.indexOf(0, "."); | |
int lastPos := pos; | |
while (pos != -1) | |
{ | |
lastPos := pos; | |
pos := s.indexOf(pos + 1, "."); | |
}; | |
^ s.delete(lastPos, s.Length - lastPos).add(".asm"); | |
} | |
public function(var path) | |
{ | |
var dir := Directory.assign(path); | |
dir.getFiles("*.vm").forEach:(item) | |
{ | |
console.printLine(item); | |
using(auto writer := File.assign(vmToAsm(item)).textwriter()) | |
{ | |
using(auto reader := File.assign(item).textreader()) | |
{ | |
while (reader.Available) | |
{ | |
// read the line | |
string line := reader.readLine(); | |
//line := line.replace(newLine,""); | |
writer.writeLine(line); | |
} | |
} | |
} | |
} | |
} | |
public program() | |
{ | |
function("My Folder"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment