small medium large xlarge

Avatar_jaime_praga_pragsmall
24 Mar 2017, 16:26
Jaime Iniesta (3 posts)

In page 17 it says this file should live in lib/coordinate.ex but later on in page 21 it looks like this file should be in agent/lib/coordinate.ex. As the link there takes you to the file without its context (maybe a git commit in a repo would be better?), it’s hard to verify the correct folder for this file.

My confusion here is that as this file defines the IslandsEnding.Coordinate module, shouldn’t it be placed in lib/islands_engine/coordinate.ex instead?

Generic-user-small
29 Mar 2017, 01:20
Lance Halvorsen (29 posts)

Ah, I see why this is confusing. In the application, all the files are in /lib, with no subdirectories.

But there are also source files that come along with the book which are arranged in directories named after their chapters. Those paths will show up in a highlighted bar above many of the snippets of example code. The reason that they are separated out by chapter is that sometimes we will change the code in any given file because of changes we make in a new chapter.

If you are writing your own app at home, just put all the files in /lib and all will be well.

Generic-user-small
16 Apr 2017, 21:54
Liam McArdle (1 post)

Lance, I do not think the confusion is because of the source files that come with the book…at least for me it’s not. When you run mix new islands_engine --sup, inside of the lib directory is a file named islands_engine.ex and a directory named islands_engine, which has a file named application.ex.

Generic-user-small
18 Apr 2017, 16:59
Lance Halvorsen (29 posts)

Sorry! I misunderstood your question the first time. It’s fine to put the files directly in lib/. No need to put them in lib/islands_engine/.

You must be logged in to comment