Skip to content
Snippets Groups Projects
Commit 2e9eed31 authored by Rodrigo Nonose's avatar Rodrigo Nonose Committed by Xiangrong Hao
Browse files

Limit split parts to allow equal characters in path (#49)

parent ef29c68e
Branches
No related tags found
No related merge requests found
...@@ -170,7 +170,7 @@ defmodule FileSystem.Backends.FSMac do ...@@ -170,7 +170,7 @@ defmodule FileSystem.Backends.FSMac do
end end
def parse_line(line) do def parse_line(line) do
[_, _, events, path] = line |> to_string |> String.split(["\t", "="]) [_, _, events, path] = line |> to_string |> String.split(["\t", "="], parts: 4)
{path, events |> String.split(~w|[ , ]|, trim: true) |> Enum.map(&String.to_existing_atom/1)} {path, events |> String.split(~w|[ , ]|, trim: true) |> Enum.map(&String.to_existing_atom/1)}
end end
......
...@@ -32,5 +32,10 @@ defmodule FileSystem.Backends.FSMacTest do ...@@ -32,5 +32,10 @@ defmodule FileSystem.Backends.FSMacTest do
assert {"/one two/file", [:inodemetamod, :modified]} == assert {"/one two/file", [:inodemetamod, :modified]} ==
parse_line('37425557\t0x00011400=[inodemetamod,modified]\t/one two/file') parse_line('37425557\t0x00011400=[inodemetamod,modified]\t/one two/file')
end end
test "equal character in file" do
assert {"/one two/file=2", [:inodemetamod, :modified]} ==
parse_line('37425557\t0x00011400=[inodemetamod,modified]\t/one two/file=2')
end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment