TinyBFG

TinyBFG

I need help getting this program to work going from windows to mac

So I am making a program that sorts out video files in non-video folders and non-video files in video folders and I am done as far as I can tell but I am having issues getting the program over to the client since it uses paths and I have very minimal experience with mac paths. So every time I try to have them test it the tests fail and it is all around the identifies_path_type_and_formats/1 function on line 72. I am new so general help will be appreciated but specifically, I need help getting this to work on mac. I will leave the GitHub link here. You can call it using mix Erovf “type filepath here”

https://github.com/TinyBFG/erovf

First Post!

easco

easco

Macintosh paths are simply Unix paths. There is not really a significant difference between them. So long as the special characters are escaped properly they should behave like unix.

Do you have examples of paths that are problematic?

Most Liked

easco

easco

I suspect the problem in your test is that it is using:

dir = "/erovf/test"

This is an absolute path that starts at the root of the file system. To make it a relative path you could either drop the leading slash erovf/test or you could add a “.” at the front ./erovf/test

I suspect that this is a problematic function:

  defp formats_basename(path) do
    "/" <> Path.basename(path)
  end

Which looks like it might be creating absolute paths when you don’t mean to.

For example if my cwd is /Users/easco/Projects/Elixir/erovf then ask for the base name:

iex(2)> File.cwd!() |> Path.basename()
"erovf"

and formats_basename will turn this into /erovf which is a folder named erovf at the root of the file system and is no longer related to the current working directory.

Last Post!

TinyBFG

TinyBFG

Sorry for the late response. The client ran the tests on his system and all of the main function related tests failed, so both identifies_misplaced_files/1 tests failed, in turn both of the mix task(run/1) tests failed (because they essentially just run identifies_misplaced_files/1). On top of that all 3 tests for identifies_path_type_and_formats/1 failed, leading to my question about paths and all probably info I should have included in the initial post so I am sorry for that. I turned “/erovf/test” into “erovf/test” and tossed format_basename/1 for just Path.basename/1 and all of my tests are passing so I am pretty happy with this solution so far. I will ask the client to pull it down one more time and run the tests again and once that happens I will return with good news or bad. Do you think that format_relative_path/1 is problematic at all?

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement