image: open curpath instead of path when cloning

This commit is contained in:
Luna 2019-09-10 21:35:22 -03:00
parent 67c42e39d4
commit 84d582cfd1
2 changed files with 8 additions and 2 deletions

View file

@ -151,7 +151,7 @@ pub const Image = struct {
pub fn clone(self: *Image) !*Image {
var in_fmt = mkSfInfo();
// 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);
std.debug.assert(in_fmt.frames > i64(0));

View file

@ -75,10 +75,13 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
if (std.mem.eql(u8, line, "push")) {
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);
defer cmds_wrapped.deinit();
try runner.runCommands(cmds_wrapped, true);
continue;
} else if (std.mem.eql(u8, line, "list")) {
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);
// 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();
defer runner_clone.deinit();