Fix to ensure directory structure created
This commit is contained in:
parent
dc28388c76
commit
18f2b5660d
2 changed files with 11 additions and 7 deletions
|
@ -572,8 +572,11 @@ start_from_file(PCLopts) ->
|
|||
levelzero_index=leveled_pmem:new_index()},
|
||||
|
||||
%% Open manifest
|
||||
ManifestPath = InitState#state.root_path ++ "/" ++ ?MANIFEST_FP ++ "/",
|
||||
ManifestPath = filepath(InitState#state.root_path, manifest) ++ "/",
|
||||
SSTPath = filepath(InitState#state.root_path, files) ++ "/",
|
||||
ok = filelib:ensure_dir(ManifestPath),
|
||||
ok = filelib:ensure_dir(SSTPath),
|
||||
|
||||
{ok, Filenames} = file:list_dir(ManifestPath),
|
||||
CurrRegex = "nonzero_(?<MSN>[0-9]+)\\." ++ ?CURRENT_FILEX,
|
||||
ValidManSQNs = lists:foldl(fun(FN, Acc) ->
|
||||
|
|
|
@ -493,12 +493,13 @@ write_file(Filename, SummaryBin, SlotsBin) ->
|
|||
SummaryLength = byte_size(SummaryBin),
|
||||
SlotsLength = byte_size(SlotsBin),
|
||||
{PendingName, FinalName} = generate_filenames(Filename),
|
||||
file:write_file(PendingName,
|
||||
<<SlotsLength:32/integer,
|
||||
SummaryLength:32/integer,
|
||||
SlotsBin/binary,
|
||||
SummaryBin/binary>>,
|
||||
[raw]),
|
||||
DirName = filename:dirname(PendingName),
|
||||
ok = file:write_file(PendingName,
|
||||
<<SlotsLength:32/integer,
|
||||
SummaryLength:32/integer,
|
||||
SlotsBin/binary,
|
||||
SummaryBin/binary>>,
|
||||
[raw]),
|
||||
case filelib:is_file(FinalName) of
|
||||
true ->
|
||||
AltName = filename:join(filename:dirname(FinalName),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue