Lines Matching defs:file
4 * you may not use this file except in compliance with the License.
23 #include <sys/file.h>
40 fl.l_whence = SEEK_SET; // Starting from beginning of file
42 fl.l_len = 0; // Lock whole file
46 // Lock failed (file is already locked)
48 return true; // Simulate that file is locked
51 // Lock acquired, simulate that file is not locked
65 fl.l_type = F_UNLCK; // Unlock the file
66 fl.l_whence = SEEK_SET; // Starting from beginning of file
68 fl.l_len = 0; // Unlock whole file
81 // Function to add a file to zip
86 std::cerr << "Failed to create entry in zip file for " << filePath << std::endl;
90 FILE* file = fopen(filePath.c_str(), "rb");
91 if (!file) {
92 std::cerr << "Failed to open file " << filePath << std::endl;
100 while ((size = fread(buffer, 1, bufferSize, file)) > 0) {
104 if (fclose(file) == EOF) {
105 std::cerr << "Failed to close file" << std::endl;
114 if (fclose(file) == EOF) {
115 std::cerr << "Failed to close file" << std::endl;
133 std::cerr << "Failed to create entry in zip file for " << entry.path() << std::endl;
138 // Add file
153 std::cerr << "Could not create zip file " << zipFilename << std::endl;
157 for (const auto& file : files) {
158 if (fs::is_directory(file)) {
160 if (!AddFolderToZip(zip, file, fs::path(file).filename())) {
165 // Add individual file
166 if (!AddFileToZip(zip, file, fs::path(file).filename())) {
174 std::cerr << "Failed to close zip file " << zipFilename << std::endl;
185 std::ofstream file(filePath);
186 if (!file) {
187 std::cerr << "Error creating file: " << filePath << std::endl;
190 file << content;
191 file.close();