What is the difference between `files` and <resour...
# ktor
a
What is the difference between
files
and resources ? StackOverflow question
✔️ 1
b
files()
looks at your file system relative to current working directory
resources()
looks at your classpath
🙏 1
a
Got it now. Thanks 🙏 . No idea why I got downvoted on SO 😕
b
Because this quote is misleading
The
resources
method does the same as the
files
method except that it allows serving all static files from the source set resource directory that could be embedded in a JAR.
a
Yeah. But was there an issue in my question on StackOverflow?
b
Oh that? No idea 😄
I’m confused too 🙂 i thought you were the one who answered it lol
b
Nah
a
@Big Chungus could you please explain why it's misleading?
a
@Aleksei Tirman [JB] i thought he was actually talking about the documentation. Your answer is clear to me.
b
For a newbie reading it at face value, it implies that resources only looks at the files you place in the
src/main/resources
(i.e. same as
files()
, but working on a different working directory), which is not the case and you can also use
resources()
to serve files on your classpath comming from other jars too.
that's why I said misleading, not wrong 🙂
a
Is it better?
The 
resources
 method does the same as the 
files
 method except that it allows serving static files from the classpath.
b
It is for me, but who am I to say what's right or wrong with these things?
a
I mean is it more precise?
b
Oh, yes it is.
a
I've edited my answer.
🙏 2
b
Hope you don't take it the wrong way. I wasn't trying to pick on you or anything, just wanted it to be clear for everyone 😄
a
Of course, I didn't 😄 It actually doesn't matter if you tried or not because you provided useful information nonetheless.