[Tex/LaTex] You have requested package `include/foo’ but the package provides `foo’

compilingpackageswarnings

I have the following files:

my_folder/
   include/
       mypackage.sty
   main.tex

The package's name is 'mypackage'. Now, in main.tex I do

\usepackage{include/mypackage}

using the file path rather than the package name. This works, but warns me:

You have requested package `include/foo' but the package provides `foo'

How do I avoid this without placing the document class file elsewhere?

Best Answer

You can disable the warning using silence package:

\documentclass{article}

\usepackage{silence}
%Disable all warnings issued by latex starting with "You have..."
\WarningFilter{latex}{You have requested package}
\usepackage{include/mypackage}

\begin{document}
\end{document}

Another solution was proposed here: https://tex.stackexchange.com/a/31950/65072