here Bu tam sorunu vardı FileSystem Modülü hakkında
//require a reference to the fs module
var fs = require('fs');
...
//changes the current workingDirectory to the specified path.
fs.changeWorkingDirectory('/your/path')
Tüm belgeler; Komut dosyasının yaşadığı yere göre bir dosyada dosya gerektirir. (Okuyun: bir sürü) biraz ile müdahalesi, şu üretmek mümkün oldu: Bu göreli yolları kullanarak fs.read()
ve spawn
dosyalara beni tanır
// Since Casper has control, the invoked script is deep in the argument stack
var currentFile = require('system').args[3];
var curFilePath = fs.absolute(currentFile).split('/');
// I only bother to change the directory if we weren't already there when invoking casperjs
if (curFilePath.length > 1) {
curFilePath.pop(); // PhantomJS does not have an equivalent path.baseName()-like method
fs.changeWorkingDirectory(curFilePath.join('/'));
}
. Belki de require()
da test etmek için modülüm yoktu.
Umut bu yararlıdır!
Do: Eğer tam yol olarak proje üzerinde ayarlayabilirsiniz Temelde
Üzerinde çalıştığınız örnek kodunuz var mı? – imjared
Merhaba, InviS. Bu yeterince cevaplandırıldı mı? Bunun üzerine bir cevap yazacak kadar nazik olabilir misiniz? Teşekkür ederim! – Morgon