Fix priv/static/instance/static to be just instance/static
authorEkaterina Vaartis <vaartis@cock.li>
Sat, 20 Apr 2019 12:06:56 +0000 (15:06 +0300)
committerEkaterina Vaartis <vaartis@cock.li>
Sat, 20 Apr 2019 12:08:51 +0000 (15:08 +0300)
It was a misunderstanding

lib/mix/tasks/pleroma/emoji.ex
lib/pleroma/emoji.ex

index 0a1bf24e2007c4bfa3fb17247194b693fddd7ab9..02cfaa7749c8cf1fcdff1571486eabb926e8d606 100644 (file)
@@ -137,11 +137,8 @@ defmodule Mix.Tasks.Pleroma.Emoji do
 
         IO.puts(IO.ANSI.format(["Unpacking ", :bright, pack_name]))
 
-        static_path = Path.join(:code.priv_dir(:pleroma), "static")
-
         pack_path =
           Path.join([
-            static_path,
             Pleroma.Config.get!([:instance, :static_dir]),
             "emoji",
             pack_name
@@ -161,19 +158,12 @@ defmodule Mix.Tasks.Pleroma.Emoji do
 
         IO.puts(IO.ANSI.format(["Writing emoji.txt for ", :bright, pack_name]))
 
-        common_pack_path =
-          Path.join([
-            "/",
-            Pleroma.Config.get!([:instance, :static_dir]),
-            "emoji",
-            pack_name
-          ])
-
         emoji_txt_str =
           Enum.map(
             files,
             fn {shortcode, path} ->
-              "#{shortcode}, #{Path.join(common_pack_path, path)}"
+              emojo_path = Path.join("/emoji/#{pack_name}", path)
+              "#{shortcode}, #{emojo_path}"
             end
           )
           |> Enum.join("\n")
index 15455b77984144a751d8111be8aedf4ce7fae8df..16909443843c9a37932f6a7ecf700a278faabd24 100644 (file)
@@ -81,14 +81,11 @@ defmodule Pleroma.Emoji do
   end
 
   defp load do
-    static_path = Path.join(:code.priv_dir(:pleroma), "static")
-
     emoji_dir_path =
-      Path.join([
-        static_path,
+      Path.join(
         Pleroma.Config.get!([:instance, :static_dir]),
         "emoji"
-      ])
+      )
 
     case File.ls(emoji_dir_path) do
       {:error, :enoent} ->
@@ -135,20 +132,12 @@ defmodule Pleroma.Emoji do
         "No emoji.txt found for pack \"#{pack_name}\", assuming all .png files are emoji"
       )
 
-      common_pack_path =
-        Path.join([
-          "/",
-          Pleroma.Config.get!([:instance, :static_dir]),
-          "emoji",
-          pack_name
-        ])
+      make_shortcode_to_file_map(pack_dir, [".png"]) |>
+        Enum.map(fn {shortcode, rel_file} ->
+          filename = Path.join("/emoji/#{pack_name}", rel_file)
 
-      make_shortcode_to_file_map(pack_dir, [".png"])
-      |> Enum.map(fn {shortcode, rel_file} ->
-        filename = Path.join(common_pack_path, rel_file)
-
-        {shortcode, filename, [to_string(match_extra(@groups, filename))]}
-      end)
+          {shortcode, filename, [to_string(match_extra(@groups, filename))]}
+        end)
     end
   end