Warning: session_start(): open(/var/lib/php/sessions/sess_6llqd418nbs0ejv2ho7gjkq8pl, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static int copyFileToPhone_chunkSize = 500000; // see #1004128
static void copyFileToPhone(S localPath, S destPath, bool withContinue) {
copyFileToPhone(new File(localPath), destPath, withContinue);
}
static void copyFileToPhone(File f, S destPath, bool withContinue) {
if (!f.isFile()) fail("Not a file: " + f2s(f));
if (destPath.endsWith("/")) destPath += f.getName();
long i = 0;
long len = f.length();
DialogIO io = talkTo(gateway(), 4999);
try {
if (withContinue) {
i = parseLong(io.askLoudly(forward("Awareness", "get file * length", destPath)));
if (i == len) { print("File fully copied"); ret; }
}
if (i == 0)
io.askLoudly(forward("Awareness", "delete file *", destPath));
for (; i < len; i += copyFileToPhone_chunkSize) {
print("[Copying file to phone, " + i + "/" + len + "]");
long j = min(len, i+copyFileToPhone_chunkSize);
byte[] data = loadBinaryFileChunk(f, i, toInt(j-i));
S answer = io.ask(forward("Awareness", "write file * bin from * data *",
destPath, i, bytesToHex(data)));
assertTrue(answer, match("OK", answer));
}
} finally {
io.close();
}
}