MCPcopy Create free account
hub / github.com/devkitPro/3ds-hbmenu / menuFileAssocScan

Function menuFileAssocScan

source/menu-list.c:118–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118int menuFileAssocScan(const char* target)
119{
120 menuFileAssocClear();
121
122 if (chdir(target) < 0)
123 return 1;
124
125 if (getcwd(s_menuFileAssoc[!s_curMenuFileAssoc].dirname, PATH_MAX + 1) == NULL)
126 return 1;
127
128 DIR* dir;
129 struct dirent* dp;
130 char temp[PATH_MAX + 1];
131
132 dir = opendir(s_menuFileAssoc[!s_curMenuFileAssoc].dirname);
133 if (!dir)
134 return 2;
135
136 while ((dp = readdir(dir))) {
137 if (dp->d_name[0] == '.')
138 continue;
139
140 memset(temp, 0, sizeof(temp));
141 snprintf(temp, sizeof(temp) - 1, "%s/%s", s_menuFileAssoc[!s_curMenuFileAssoc].dirname, dp->d_name);
142
143 const char* ext = getExtension(dp->d_name);
144 if (strcasecmp(ext, ".cfg") != 0)
145 continue;
146
147 menuEntryFileAssocLoad(temp);
148 }
149
150 closedir(dir);
151 s_curMenuFileAssoc = !s_curMenuFileAssoc;
152 menuFileAssocClear();
153
154 return 0;
155}
156
157int menuScan(const char* target)
158{

Callers 1

menuLoadFileAssocFunction · 0.85

Calls 3

menuFileAssocClearFunction · 0.85
getExtensionFunction · 0.85
menuEntryFileAssocLoadFunction · 0.85

Tested by

no test coverage detected