file path seperators
This commit is contained in:
parent
f3f9a20824
commit
ddf89f926f
2 changed files with 3 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ pub fn run(allocator: std.mem.Allocator, svc: *zfin.DataService, file_path: []co
|
||||||
defer pf_data.deinit(allocator);
|
defer pf_data.deinit(allocator);
|
||||||
|
|
||||||
// Load classification metadata
|
// Load classification metadata
|
||||||
const dir_end = if (std.mem.lastIndexOfScalar(u8, file_path, '/')) |idx| idx + 1 else 0;
|
const dir_end = if (std.mem.lastIndexOfScalar(u8, file_path, std.fs.path.sep)) |idx| idx + 1 else 0;
|
||||||
const meta_path = std.fmt.allocPrint(allocator, "{s}metadata.srf", .{file_path[0..dir_end]}) catch return;
|
const meta_path = std.fmt.allocPrint(allocator, "{s}metadata.srf", .{file_path[0..dir_end]}) catch return;
|
||||||
defer allocator.free(meta_path);
|
defer allocator.free(meta_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub fn loadData(app: *App) void {
|
||||||
// Look for metadata.srf next to the portfolio file
|
// Look for metadata.srf next to the portfolio file
|
||||||
if (app.portfolio_path) |ppath| {
|
if (app.portfolio_path) |ppath| {
|
||||||
// Derive metadata path: same directory as portfolio, named "metadata.srf"
|
// Derive metadata path: same directory as portfolio, named "metadata.srf"
|
||||||
const dir_end = if (std.mem.lastIndexOfScalar(u8, ppath, '/')) |idx| idx + 1 else 0;
|
const dir_end = if (std.mem.lastIndexOfScalar(u8, ppath, std.fs.path.sep)) |idx| idx + 1 else 0;
|
||||||
const meta_path = std.fmt.allocPrint(app.allocator, "{s}metadata.srf", .{ppath[0..dir_end]}) catch return;
|
const meta_path = std.fmt.allocPrint(app.allocator, "{s}metadata.srf", .{ppath[0..dir_end]}) catch return;
|
||||||
defer app.allocator.free(meta_path);
|
defer app.allocator.free(meta_path);
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ pub fn loadData(app: *App) void {
|
||||||
// Load account tax type metadata file (optional)
|
// Load account tax type metadata file (optional)
|
||||||
if (app.account_map == null) {
|
if (app.account_map == null) {
|
||||||
if (app.portfolio_path) |ppath| {
|
if (app.portfolio_path) |ppath| {
|
||||||
const dir_end = if (std.mem.lastIndexOfScalar(u8, ppath, '/')) |idx| idx + 1 else 0;
|
const dir_end = if (std.mem.lastIndexOfScalar(u8, ppath, std.fs.path.sep)) |idx| idx + 1 else 0;
|
||||||
const acct_path = std.fmt.allocPrint(app.allocator, "{s}accounts.srf", .{ppath[0..dir_end]}) catch {
|
const acct_path = std.fmt.allocPrint(app.allocator, "{s}accounts.srf", .{ppath[0..dir_end]}) catch {
|
||||||
loadDataFinish(app, pf, summary);
|
loadDataFinish(app, pf, summary);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue