TinyBFG

TinyBFG

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

Showing Posts 1 to 3

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?

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.

TinyBFG

TinyBFG OP

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?

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews