Skip to content

Commit

Permalink
[core] BuildDirectoryContent takes the extension without dot
Browse files Browse the repository at this point in the history
  • Loading branch information
mean committed Apr 3, 2019
1 parent 0bffbbb commit b7d35a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion avidemux/common/GUI_jobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ uint8_t GUI_jobs(void)
uint32_t nb;
memset(jobName,0,sizeof(jobName));
const char *jobDir=ADM_getJobDir();
if(!buildDirectoryContent(&nb,ADM_getJobDir(),jobName,MAX_JOBS,".py"))
if(!buildDirectoryContent(&nb,ADM_getJobDir(),jobName,MAX_JOBS,"py"))
{
delete [] jobDir;
GUI_Error_HIG(QT_TRANSLATE_NOOP("jobs","Oops"),QT_TRANSLATE_NOOP("jobs","Something very wrong happened when building joblist."));
Expand Down
9 changes: 6 additions & 3 deletions avidemux_core/ADM_core/src/ADM_folder_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ uint8_t buildDirectoryContent(uint32_t *outnb, const char *base, char *jobName[]
DIR *dir;
struct dirent *direntry;
int dirmax = 0, len;
int extlen = strlen(ext);
int extlen = strlen(ext)+1;
ADM_assert(extlen>1);

ADM_assert(extlen);
char *dotted=(char *)admAlloca(extlen+1);
strcpy(dotted+1,ext);
dotted[0]='.';

const char *base2 = base;

Expand All @@ -144,7 +147,7 @@ uint8_t buildDirectoryContent(uint32_t *outnb, const char *base, char *jobName[]

int xbase = len - extlen;

if (memcmp(d_name + xbase, ext, extlen))
if (memcmp(d_name + xbase, dotted, extlen))
{
printf("ignored: %s\n", d_name);
continue;
Expand Down
4 changes: 2 additions & 2 deletions avidemux_plugins/ADM_videoEncoder/x264/qt4/Q_x264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ x264Dialog::x264Dialog(QWidget *parent, void *param) : QDialog(parent)
}

upload();
ADM_pluginInstallSystem( std::string("x264"),std::string(".json"),pluginVersion);
ADM_pluginInstallSystem( std::string("x264"),std::string("json"),pluginVersion);
updatePresetList();
int n=ui.configurationComboBox->count();
ui.configurationComboBox->setCurrentIndex(n-1);
Expand All @@ -201,7 +201,7 @@ bool x264Dialog::updatePresetList(void)
std::string rootPath;
vector <std::string > list;
ADM_pluginGetPath("x264",pluginVersion,rootPath);
ADM_listFile(rootPath,".json",list);
ADM_listFile(rootPath,"json",list);
int l=list.size();
combo->clear();
for( int i=0;i<l;i++)
Expand Down
4 changes: 2 additions & 2 deletions avidemux_plugins/ADM_videoEncoder/x265/qt4/Q_x265.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ x265Dialog::x265Dialog(QWidget *parent, void *param) : QDialog(parent)
}

upload();
ADM_pluginInstallSystem( std::string("x265"),std::string(".json"),pluginVersion);
ADM_pluginInstallSystem( std::string("x265"),std::string("json"),pluginVersion);
updatePresetList();
int n=ui.configurationComboBox->count();
ui.configurationComboBox->setCurrentIndex(n-1);
Expand All @@ -207,7 +207,7 @@ bool x265Dialog::updatePresetList(void)
std::string rootPath;
vector <std::string > list;
ADM_pluginGetPath("x265",pluginVersion,rootPath);
ADM_listFile(rootPath,".json",list);
ADM_listFile(rootPath,"json",list);
int l=list.size();
combo->clear();
for( int i=0;i<l;i++)
Expand Down

0 comments on commit b7d35a9

Please sign in to comment.