-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "phoenix_live_reload/issues/67" #2679
Conversation
Sometimes the built file will be empty after live reload. [#67](phoenixframework/phoenix_live_reload#67)
lib/phoenix/code_reloader/server.ex
Outdated
build_path = Mix.Project.build_path() | ||
symlink = Path.join(Path.dirname(build_path), "__phoenix__") | ||
|
||
case File.ln_s(build_path, symlink) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a recursive symlink? I don't think there is anything wrong with it but it would probably be best to avoid it. Maybe we should try to symlink app_path/priv to priv, which is the symlink we would build at the end of the day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore me, we are using the same link as before. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and I think this is not the best way too. Those codes that create a temp symlink and then remove them maybe just a opportunistic way.
What the can_symlink
function actually need to do is just, find that is the task are running
with Administrator
and have permission to create symlinks.
But since those codes exist in the old version and the have works well, I became lazy to find other solutions, just move them into the can_symlink
function.
lib/phoenix/code_reloader/server.ex
Outdated
defp os_symlink(_), | ||
do: "" | ||
|
||
defp can_symlink() do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can name this function can_symlink?
and have it return a boolean.
Sometimes the built file will be empty after live reload. #67