image: open curpath instead of path when cloning
This commit is contained in:
parent
67c42e39d4
commit
84d582cfd1
2 changed files with 8 additions and 2 deletions
|
@ -151,7 +151,7 @@ pub const Image = struct {
|
||||||
pub fn clone(self: *Image) !*Image {
|
pub fn clone(self: *Image) !*Image {
|
||||||
var in_fmt = mkSfInfo();
|
var in_fmt = mkSfInfo();
|
||||||
// clone sndfile
|
// clone sndfile
|
||||||
var sndfile = try sopen(self.allocator, self.path, c.SFM_READ, &in_fmt);
|
var sndfile = try sopen(self.allocator, self.curpath, c.SFM_READ, &in_fmt);
|
||||||
var image = try allocator.create(Image);
|
var image = try allocator.create(Image);
|
||||||
|
|
||||||
std.debug.assert(in_fmt.frames > i64(0));
|
std.debug.assert(in_fmt.frames > i64(0));
|
||||||
|
|
|
@ -75,10 +75,13 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
|
||||||
|
|
||||||
if (std.mem.eql(u8, line, "push")) {
|
if (std.mem.eql(u8, line, "push")) {
|
||||||
try cmds.append(current);
|
try cmds.append(current);
|
||||||
|
|
||||||
|
// run the current added command to main cmds list
|
||||||
|
// with the main parent runner
|
||||||
var cmds_wrapped = try wrapInCmdList(allocator, current);
|
var cmds_wrapped = try wrapInCmdList(allocator, current);
|
||||||
defer cmds_wrapped.deinit();
|
defer cmds_wrapped.deinit();
|
||||||
|
|
||||||
try runner.runCommands(cmds_wrapped, true);
|
try runner.runCommands(cmds_wrapped, true);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if (std.mem.eql(u8, line, "list")) {
|
} else if (std.mem.eql(u8, line, "list")) {
|
||||||
try printer.printList(cmds, stdout);
|
try printer.printList(cmds, stdout);
|
||||||
|
@ -95,6 +98,9 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
|
||||||
};
|
};
|
||||||
current = cmds_parsed.at(0);
|
current = cmds_parsed.at(0);
|
||||||
|
|
||||||
|
// by cloning the parent runner, we can iteratively write
|
||||||
|
// whatever command we want and only commit the good results
|
||||||
|
// back to the parent runner
|
||||||
var runner_clone = try runner.clone();
|
var runner_clone = try runner.clone();
|
||||||
defer runner_clone.deinit();
|
defer runner_clone.deinit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue