Commit Graph

148 Commits

Author SHA1 Message Date
Max Kellermann
b373c53ce4 *: add missing Compiler.h includes
Necessary for "final" on gcc 4.6.
2014-08-30 00:46:52 +02:00
Max Kellermann
8283f23651 fs/io/TextFile: add method Check() 2014-08-11 22:53:48 +02:00
Max Kellermann
7cc25f91ff fs/io/Reader: add "nonnull" attribute 2014-08-11 22:49:08 +02:00
Max Kellermann
486b5b6bfc fs/io/TextFile: use AutoGunzipReader
Several MPD subsystems can now read gzipped files; for example, the
database file can be gzipped.
2014-08-11 21:48:25 +02:00
Max Kellermann
88a2f128ec fs/io/AutoGunzipReader: new class 2014-08-11 21:48:25 +02:00
Max Kellermann
45c139cfb3 fs/io/PeekReader: new utility class 2014-08-11 21:48:25 +02:00
Max Kellermann
3a111e5d74 fs/io/GzipOutputStream,GunzipReader: move zlib_domain to src/lib/zlib/Domain.cxx 2014-08-11 21:48:25 +02:00
Max Kellermann
a67a881715 input/GunzipInputStream: new class 2014-08-08 20:11:29 +02:00
Max Kellermann
aa2e4d92e0 fs/io/BufferedReader: new class to replace class TextFile
The new class is pluggable, to prepare for gzipped database files.

For now, the TextFile class remains, and will be refactored away
later.
2014-08-07 19:38:25 +02:00
Max Kellermann
0ea66a1275 fs/io/Reader: new interface 2014-08-07 19:38:25 +02:00
Max Kellermann
aafff8fd5c fs/output, fs/TextFile: move to fs/io/ 2014-08-07 19:38:25 +02:00
Max Kellermann
bbea6564fc fs/output/FileOutputStream: use open_cloexec()
Support operating systems that don't have O_CLOEXEC.
2014-08-07 18:16:11 +02:00
Max Kellermann
59d38f876a util/StringUtil: add StripRight() overload with "end" argument 2014-08-07 16:08:02 +02:00
Max Kellermann
87bcf739ee util/StringUtil: rename strchug_fast() to StripLeft() 2014-08-07 16:08:02 +02:00
Max Kellermann
17b316b94b fs/StandardDirectory: pass writable string to ParseConfigLine()
Eliminate the std::string overhead.
2014-08-07 16:07:52 +02:00
Max Kellermann
c9a71a7176 fs/GzipOutputStream: new class wrapping zlib 2014-08-06 16:35:10 +02:00
Max Kellermann
0d0ccacdf3 fs/OutputStream: new infrastructure for writing to files 2014-07-30 22:12:02 +02:00
Mantas Mikulėnas
cd289843f7 fs/StandardDirectory: look for cache dir in environment, not user-dirs
The XDG cache directory is part of the "base directories" spec like
$XDG_CONFIG_HOME, not "user directories".
2014-07-11 08:09:19 +02:00
Max Kellermann
36ca57a54e fs/StandardDirectory: add GetUserCacheDir()
Move code from CreateConfiguredDatabase() and add XDG support.  This
implements an automatic Linux fallback for the setting "db_file" if
none was specified.
2014-03-01 22:51:51 +01:00
Max Kellermann
5268f55344 java/File: add method ToAbsolutePath() returning AllocatedPath 2014-03-01 20:53:39 +01:00
Max Kellermann
58771fc41c Android: obtain music directory from Environment.getExternalStoragePublicDirectory() 2014-03-01 18:48:20 +01:00
Max Kellermann
8fe004e98e fs/Charset: use "UTF-8" instead of "utf-8" as the default value
The upper-case name seems to be the canonical one.
2014-02-23 22:03:40 +01:00
Max Kellermann
1709ab6810 fs/TextFile: use custom allocation instead of GString 2014-02-17 23:04:10 +01:00
Max Kellermann
ce925ba56f fs/Charset: disable if GLib is disabled 2014-02-17 22:48:26 +01:00
Max Kellermann
ec8873b178 Mapper: move check_directory() to the filesystem library 2014-02-07 23:25:47 +01:00
Max Kellermann
d744c997d8 fs/Traits: add function Relative()
Move code from Path::RelativeFS() and make it generic.
2014-02-07 19:08:51 +01:00
Max Kellermann
c310941f69 fs/AllocatedPath: add conversion constructor from Path 2014-01-30 23:36:57 +01:00
Max Kellermann
c02f146791 fs/DirectoryReader: GetEntry() returns Path, not AllocatedPath
Reduce overhead, don't duplicate the string.
2014-01-30 22:20:57 +01:00
Max Kellermann
0bd01824f6 fs/AllocatedPath: add Build() overlays with Path arguments 2014-01-30 22:15:13 +01:00
Max Kellermann
197b503f3e Config*: move to config/ 2014-01-24 00:20:01 +01:00
Max Kellermann
4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Denis Krjuchkov
5d85792178 fs: implemented standard directories API 2013-12-08 17:24:43 +06:00
Denis Krjuchkov
acba9c0f61 TextFile: move to fs subsystem 2013-12-08 04:15:27 +06:00
Denis Krjuchkov
38afc89407 fs/FileSystem.hxx: don't define CheckAccess() with mode on Windows 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
06d7169674 fs/FileSystem.hxx: add CheckAccess without mode parameter 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
8bf1640932 fs/Traits.cxx: don't return drive path without trailing separator 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
da50c888fe fs/Traits.hxx: introduce PathTraitsXXX::IsDrive function 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
62dc8e4131 fs/Charset.cxx: replace \ with / when converting path to UTF-8 on Windows 2013-12-05 15:04:52 +06:00
Denis Krjuchkov
cbb9149a82 fs/Traits.hxx: add shorter forms of PathTraitsXXX::Build() 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
dab7348da8 fs/Traits.hxx: add PathTraitsUTF8::GetLength for consistency 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
378e8a6224 fs/AllocatedPath.cxx: don't use g_path_get_dirname 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
289fdcc52b fs/Traits: implement GetBase/GetParent/Build using templates 2013-12-05 12:35:21 +06:00
Denis Krjuchkov
83e6e3e31f fs/Traits.cxx: don't return empty string if parent dir is root 2013-12-05 12:27:31 +06:00
Denis Krjuchkov
c387031252 fs/Traits.hxx: add FindLastSeparator function to PathTraitsXXX 2013-12-05 04:09:07 +06:00
Denis Krjuchkov
403bd77eff fs/Traits: improve compatibility between PathTraitsFS and PathTraitsUTF8 2013-12-05 04:01:29 +06:00
Denis Krjuchkov
b397c46184 fs/Traits.hxx: add gcc_nonnull_all where applicable 2013-12-05 03:56:51 +06:00
Denis Krjuchkov
0a6c4c31b2 fs/Traits: split PathTraits type into PathTraitsFS and PathTraitsUTF8 2013-12-05 03:53:43 +06:00
Denis Krjuchkov
55ed7bd34d AllocatedPath.hxx: use move constructor 2013-12-03 14:57:26 +06:00
Denis Krjuchkov
eeeef3eab5 fs/AllocatedPath: use PathTraits::BuildFS 2013-12-03 13:50:50 +06:00
Denis Krjuchkov
96413b1604 fs/Traits.hxx: implement BuildFS() method 2013-12-03 13:46:05 +06:00
Denis Krjuchkov
2278fe42e5 fs/Traits.hxx: move definition of AllocatedPath::string to PathTraits 2013-12-03 13:37:35 +06:00
Denis Krjuchkov
3a183f869f fs/Traits.hxx: add GetLengthFS()
There is no GetLengthUTF8() because strlen or std::string::size()
could be used instead.
2013-12-03 12:26:05 +06:00
Denis Krjuchkov
6c5828822c fs/AllocatedPath.hxx: add FromFS(std::string) method 2013-12-03 12:16:53 +06:00
Denis Krjuchkov
9dd824ba50 fs/Traits.hxx: don't use g_path_is_absolute 2013-12-03 11:59:57 +06:00
Denis Krjuchkov
d744ea3fca fs/Traits.hxx: simplify code
- Move definition of SEPARATOR_UTF8 out of #ifdef
- Remove duplicated check in IsSeparatorUTF8
2013-12-03 11:48:45 +06:00
Max Kellermann
f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Max Kellermann
20597b3632 *: use nullptr instead of NULL 2013-10-28 23:58:17 +01:00
Max Kellermann
83c726a34f GetBaseUTF8 2013-10-21 10:50:22 +02:00
Max Kellermann
93068f10ec fs/AllocatedPath: don't include glib.h 2013-10-21 10:27:14 +02:00
Max Kellermann
abfbd55305 fs/Path: rename to AllocatedPath
The new class Path only holds a string pointer without being
responsible for allocation/deallocation.  The FileSystem.hxx library
accepts Path arguments instead of AllocatedPath, to avoid forcing
callers to allocate another string object.
2013-10-17 23:43:46 +02:00
Max Kellermann
b3611524f4 fs/Path: move definitions to struct PathTraits 2013-10-17 23:23:25 +02:00
Max Kellermann
a63613dba0 fs/Path: include clenaup 2013-10-17 23:20:26 +02:00
Max Kellermann
7fec2b02d4 fs/Charset: GetFSCharset() returns "utf-8" by default
If fs_charset is empty, i.e. we're using the default "utf-8",
GetFSCharset() should return exactly that instead of an empty
std::string.
2013-10-17 22:47:09 +02:00
Max Kellermann
608a98c873 fs/Charset: default filesystem charset is UTF-8
Implement a fast path for UTF-8 which leaves fs_charset empty, and
don't assign a value to fs_charset if there's no configuration.
2013-10-17 22:42:22 +02:00
Max Kellermann
f951e5356b fs/Charset: don't allow nullptr arguments 2013-10-17 22:39:06 +02:00
Max Kellermann
080ee87e07 fs/Path: move configuration code to Config.cxx 2013-10-17 22:29:03 +02:00
Max Kellermann
fa60b9ae94 fs/Path: move path_domain to Domain.hxx 2013-10-17 22:20:53 +02:00
Max Kellermann
0d33ae52c6 fs/Path: make fs_charset static 2013-10-17 22:10:27 +02:00
Max Kellermann
77e4b28092 fs/Path: include cleanup 2013-10-17 22:08:57 +02:00
Max Kellermann
4817437d31 fs/Limits: convert macro to "constexpr" 2013-10-17 22:08:56 +02:00
Max Kellermann
354b5a9365 fs/Path: move MPD_PATH_MAX to Limits.hxx 2013-10-17 22:00:01 +02:00
Max Kellermann
be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann
e4e80ff0cb *: use WIN32 instead of G_OS_WIN32 2013-10-15 08:33:44 +02:00
Max Kellermann
9508ea982b fs/Path: add method IsAbsolute() 2013-10-14 22:38:29 +02:00
Max Kellermann
47d655ea7f fs/Path: add separator constants/functions 2013-10-14 22:26:23 +02:00
Max Kellermann
0b27ac2f5c fs/Path: add method RelativeFS()
Move code from map_fs_to_utf8().
2013-10-14 22:09:02 +02:00
Max Kellermann
b915e43391 fs/Path: add method data() 2013-10-14 21:57:43 +02:00
Max Kellermann
060814daa8 Log: new logging library API
Prepare to migrate away from GLib.  Currently, we're still using GLib
as a backend.
2013-10-02 08:57:55 +02:00
Max Kellermann
43675717b8 filesystem/Path: use std::string 2013-10-02 08:56:27 +02:00
Max Kellermann
1ee6a78cb7 Path: add FromUTF8() overload that returns an Error 2013-09-12 10:17:41 +02:00
Max Kellermann
bf4ee48efa ConfigPath: move path_domain to system/Path.cxx 2013-09-12 10:03:37 +02:00
Max Kellermann
7a4c9f5f4c mpd_error.h: remove obsolete header
Migrate the remaining callers to FatalError().
2013-09-05 18:26:46 +02:00
Max Kellermann
26d92c80ed conf.h: remove obsolete header
Use only ConfigData.hxx in plugin sources to reduce header
dependencies.
2013-09-05 08:47:10 +02:00
Max Kellermann
3ac2e9d31f os/FileSystem: disable mkfifo() wrapper on WIN32 2013-08-07 20:31:27 +02:00
Max Kellermann
b76a29a69a ConfigPath: return a Path object
Migrate all callers to use Path directly, instead of doing the
conversion in each caller.
2013-08-07 19:59:09 +02:00
Max Kellermann
b70d38dc10 Makefile.am: move sources to libsystem.a 2013-08-07 10:31:31 +02:00
Denis Krjuchkov
896015bf53 DirectoryReader: rename Failed() to HasFailed() for consistency with TextFile 2013-05-05 13:34:12 +06:00
Denis Krjuchkov
17dca254a3 Path.hxx: add GetDirectoryName() method 2013-02-02 19:28:02 +06:00
Denis Krjuchkov
f6b50d2387 FileSystem.hxx: add FOpen modes for appending files 2013-02-02 19:20:10 +06:00
Denis Krjuchkov
e98e2a0b07 Path::FromUTF8() returns nulled instance on error, add error handling where required 2013-01-28 00:13:46 +06:00
Denis Krjuchkov
943064bb51 Path: convert remaining funcs to methods, keep fs_charset as std::string 2013-01-28 00:13:46 +06:00
Denis Krjuchkov
7149a8ae4f Path: merge utf8_to_fs_charset() into Path::FromUTF8() 2013-01-28 00:13:45 +06:00
Denis Krjuchkov
3c7cf94643 Path: convert fs_charset_to_utf8() to static method Path::ToUTF8() 2013-01-28 00:13:45 +06:00
Denis Krjuchkov
3bd35d1883 Path: introduce MPD_PATH_MAX_UTF8 2013-01-28 00:13:45 +06:00
Denis Krjuchkov
e995cd928c Path: define MPD_PATH_MAX to 260 on Windows 2013-01-26 11:18:12 +06:00
Denis Krjuchkov
292d7c3fdf Path: ToUTF() returns std::string 2013-01-26 11:16:12 +06:00
Denis Krjuchkov
ef93cdf4a8 Path: move to fs subdirectory 2013-01-22 01:24:53 +06:00
Denis Krjuchkov
4ad90e2d52 FileSystem: extract DirectoryReader, improve the rest
- DirectoryReader is extracted to separate header
- FileSystem.cxx/FileSystem.hxx/DirectoryReader.hxx moved to fs/ subdir
- Functions return true on success, instead of 0 (where applicable)
- ReadLink return result instead of out parameter
- UnlinkFile is renamed to RemoveFile
- CheckExists/CheckIsRegular/CheckIsDirectory are renamed
  to PathExists/FileExists/DirectoryExists
2013-01-22 01:05:30 +06:00