MCPcopy Create free account
hub / github.com/amule-project/amule / writeLink

Function writeLink

src/ED2KLinkParser.cpp:263–282  ·  view source on GitHub ↗

* Writes a string to the ED2KLinks file. * * If errors are detected, it will terminate the program. */

Source from the content-addressed store, hash-verified

261 * If errors are detected, it will terminate the program.
262 */
263static void writeLink( const string& uri, const string& config_dir )
264{
265 // Attempt to lock the ED2KLinks file
266 static CFileLock lock(GetLinksFilePath(config_dir));
267 static std::ofstream file;
268
269 if (!file.is_open()) {
270 string path = GetLinksFilePath(config_dir);
271 file.open( path.c_str(), std::ofstream::out | std::ofstream::app );
272
273 if (!file.is_open()) {
274 std::cout << "ERROR! Failed to open " << path << " for writing!" << std::endl;
275 exit(1);
276 }
277 }
278
279 file << uri << std::endl;
280
281 std::cout << "Link successfully queued." << std::endl;
282}
283
284
285/**

Callers 1

mainFunction · 0.85

Calls 1

GetLinksFilePathFunction · 0.85

Tested by

no test coverage detected