comipoli を gjs 化するので python3 の zipfile が使えない。
ということで unzip コマンドを使う方法に切り替えるのだが
展開する内部ファイル名にブラケット [, ] があると展開できないと気が付いた。
検索するとアスタリスクが駄目なことは皆気がついているようだ、他にもあるかな?
file-roller の GPL ソースを見るのが一番速い。
file-roller/fr-command-zip.c at master ? GNOME/file-roller ? GitHub
[]*?!^-\
こんなにあった、てか記号全部ではないのね。
駄目文字の前にバックスラッシュを付けるだけだし変換は簡単だね。
var ComipoliArchive = class ComipoliArchive {
// etc...
_zipEscape(str) {
const ESCAPE = "[]*?!^-\\";
let res = "";
for (let s of str) {
if (ESCAPE.includes(s)) res += "\\";
res += s;
}
return res;
}
getItem(num) {
let cmdArray = null;
let pixbuf = null;
switch (this.status) {
case 1:
cmdArray = ["unrar", "p", "-inul", "-@", "--", this.path, this.namelist[num]];
break;
case 2:
cmdArray = ["7za", "x", "-so", this.path, this.namelist[num]];
break;
default:
//cmdArray = ["unzip", "-pj", this.path, this.namelist[num]];
cmdArray = ["unzip", "-pj", this.path, this._zipEscape(this.namelist[num])];
}
let sp = Gio.Subprocess.new(cmdArray, Gio.SubprocessFlags.STDOUT_PIPE);
let stream = sp.get_stdout_pipe();
try {
pixbuf = GdkPixbuf.Pixbuf.new_from_stream(stream, null);
}
catch(e) {
print("Error: " + this.namelist[num] + "\n" + e);
}
stream.close(null);
return pixbuf;
}
}
展開できた。
しかし cairo 描写に書き換えたら 3D で動く毎に draw シグナルが…
これでは clutter_actor_save_easing_state が使えないや。