Allow individual plugin controls to be shown / hidden.
[ardour.git] / libs / taglib / tests / utils.h
1 #include <string>
2 #include <stdio.h>
3 #include <sys/fcntl.h>
4
5 using namespace std;
6
7 inline string copyFile(const string &filename, const string &ext)
8 {
9   string newname = string(tempnam(NULL, NULL)) + ext;
10   string oldname = string("data/") + filename + ext;
11   char buffer[4096];
12   int bytes;
13   int inf = open(oldname.c_str(), O_RDONLY);
14   int outf = open(newname.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
15   while((bytes = read(inf, buffer, sizeof(buffer))) > 0)
16     write(outf, buffer, bytes);
17   close(outf);
18   close(inf);
19   return newname;
20 }
21
22 inline void deleteFile(const string &filename)
23 {
24   remove(filename.c_str());
25 }