Erlang 20 / Elixir 1.5处理网络共享文件夹的文件路径有何变化?在我在Windows服务器上运行的Elixir应用程序中,我曾经能够引用包含虚拟驱动器名称的文件路径(例如,V :),它映射到共享网络文件夹(例如,\ server1 \ shared_folder),但之后最近升级Erlang / Elixir(这可能是巧合)它似乎无法识别这些文件路径。
例如,Monitor.start_link(dirs: ["C:/data/"])
有效,但Monitor.start_link(dirs: ["V:/data/"]
没有。
如果有帮助,这里是监控模块。
defmodule FinReporting.Monitor do
use GenServer
alias FinReporting.Repo
alias FinReporting.AppState
def start_link(args) do
GenServer.start_link(__MODULE__, args)
end
def init(args) do
{:ok, watcher_pid} = FileSystem.start_link(args)
FileSystem.subscribe(watcher_pid)
IO.inspect(watcher_pid, label: "Watcher PID")
{:ok, %{watcher_pid: watcher_pid}}
end
def handle_info({:file_event, watcher_pid, {path, events}},
%{watcher_pid: watcher_pid}=state) do
callback(path, events)
{:noreply, state}
end
def handle_info({:file_event, watcher_pid, :stop},
%{watcher_pid: watcher_pid}=state) do
callback(:stop)
{:noreply, state}
end
# The callback runs a python module using erlport
def callback(:stop) do
IO.puts "STOP"
end
def callback(file_path, events) do
case {file_path, events} do
{"e:\\reporting_temp\\data\\mls_alltrans\\AllTrans - All MLS_postdate.txt", [:modified]} ->
affix = File.stat!(file_path).mtime
|> :calendar.universal_time_to_local_time
|> Ecto.DateTime.from_erl()
|> Calendar.Strftime.strftime!("%b %d (%a) %l:%M %P")
result = AppState.changeset(%AppState{}, %{key: "alltrans_filechange_" <> affix, value: "downloaded"})
|> Repo.insert
case result do
{:ok, struct} ->
IO.inspect("inserted successfully")
py_mls_upload()
{:error, changeset} -> IO.inspect("insert failed")
end
{ _ , _ } ->
IO.inspect {file_path, events, "irrelevant"}
end
end
defp py_mls_upload do
{:ok, pp} = :python.start([{:python_path, to_char_list(Path.expand("lib/python_scripts"))}, {:python, 'python'}])
:python.call(pp, :mlsupload, :run, [])
end
end