ls: removed myStat(), isFile(), isDir()
The mapper code has replaced these functions.
This commit is contained in:
parent
5b71d5f6f7
commit
f521c12d20
47
src/ls.c
47
src/ls.c
|
@ -21,7 +21,6 @@
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utf8.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "os_compat.h"
|
#include "os_compat.h"
|
||||||
|
@ -181,39 +180,6 @@ int lsPlaylists(struct client *client, const char *utf8path)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int myStat(const char *utf8file, struct stat *st)
|
|
||||||
{
|
|
||||||
char path_max_tmp[MPD_PATH_MAX];
|
|
||||||
const char *file = utf8_to_fs_charset(path_max_tmp, utf8file);
|
|
||||||
const char *actualFile = file;
|
|
||||||
|
|
||||||
if (actualFile[0] != '/')
|
|
||||||
actualFile = rmp2amp_r(path_max_tmp, file);
|
|
||||||
|
|
||||||
return stat(actualFile, st);
|
|
||||||
}
|
|
||||||
|
|
||||||
int isFile(const char *utf8file, time_t * mtime)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if (myStat(utf8file, &st) == 0) {
|
|
||||||
if (S_ISREG(st.st_mode)) {
|
|
||||||
if (mtime)
|
|
||||||
*mtime = st.st_mtime;
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
DEBUG("isFile: %s is not a regular file\n", utf8file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DEBUG("isFile: failed to stat: %s: %s\n", utf8file,
|
|
||||||
strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* suffixes should be ascii only characters */
|
/* suffixes should be ascii only characters */
|
||||||
const char *getSuffix(const char *utf8file)
|
const char *getSuffix(const char *utf8file)
|
||||||
{
|
{
|
||||||
|
@ -228,19 +194,6 @@ const char *getSuffix(const char *utf8file)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isDir(const char *utf8name)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if (myStat(utf8name, &st) == 0) {
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next)
|
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next)
|
||||||
{
|
{
|
||||||
struct decoder_plugin *ret = NULL;
|
struct decoder_plugin *ret = NULL;
|
||||||
|
|
6
src/ls.h
6
src/ls.h
|
@ -34,14 +34,8 @@ int isValidRemoteUtf8Url(const char *utf8url);
|
||||||
|
|
||||||
int isRemoteUrl(const char *url);
|
int isRemoteUrl(const char *url);
|
||||||
|
|
||||||
int myStat(const char *utf8file, struct stat *st);
|
|
||||||
|
|
||||||
int isDir(const char *utf8name);
|
|
||||||
|
|
||||||
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next);
|
struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next);
|
||||||
|
|
||||||
int printRemoteUrlHandlers(struct client *client);
|
int printRemoteUrlHandlers(struct client *client);
|
||||||
|
|
||||||
int isFile(const char *utf8file, time_t * mtime);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue