Including file in .cls

I have created a class and defined a command in there, to create a titlepage:

class.cls :

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2019/03/25 myLaTeX class]

\RequirePackage{etoolbox}
\RequirePackage{babel}

\edef\file@titlepage{titlepage-\languagename}

\renewcommand{\titlepage}{%

\makeatletter

\input{\file@titlepage.def}

\raggedright

\pagebreak
}


Now I am calling \titlepage in the .tex file:

\documentclass[english]{myclass}

\begin{document}
\titlepage
\end{document}


My texmf directory looks like that:

• C:\localtexmf\tex\latex\myclass:

• myclass.cls
• titlepage-english.def

Now the compiler always throws the following error:

File titlepage-english.def' not found. \titlepage

• that seems strange it should be found if the class is, although you may want to make your class use \InputIfFileExists rather than \input so that you get more friendly behaviour with languages for which you do not have an existing def file. – David Carlisle Mar 26 at 11:35
• That is a good idea. I will implement \InputIfFileExists – Ahrtaler Mar 26 at 11:42
• I am not sure, if it was clear, but the \InputIfFileExists command did not solved my problem. It was only a good idea to extend myclass – Ahrtaler Mar 26 at 21:56
• yes i do not see how latex can find the class but not the def file if they are in the same directory, .. unless that directory is managed by mktexlsr and you added the .def file since you last re-created the cashed file list. – David Carlisle Mar 26 at 21:59
• @DavidCarlisle Exactly that was the problem. I created the def file after the cls file. After I created the cls file, I decided to update miktex. But after I created the def file I forget to update the filename database. – Ahrtaler Mar 26 at 22:35

Now I found the problem. After adding files into a tex-root directory, it is important to update the file name database`. You can do that in MikTex console at Tasks>refresh file name database.