-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file autorecover.cpp
** \brief Template File
**
** $Id: autorecover.cpp,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $
**
** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
** \endlegal
*/
/* ========================================================================= */
#include "autorecover.h"
+#ifdef HAVE_SYS_ERRNO_H
+#include <sys/errno.h>
+#endif
//#include <unistd.h>
#include "app.h"
-#include <sinfg/savecanvas.h>
-#include <sinfg/loadcanvas.h>
+#include <synfig/savecanvas.h>
+#include <synfig/loadcanvas.h>
#include <fstream>
#include <iostream>
#include "instance.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
if(mkdir(get_shadow_directory().c_str(),ACCESSPERMS)<0)
{
if(errno!=EEXIST)
- sinfg::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str());
+ synfig::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str());
}
else
{
- sinfg::info("Created directory \"%s\"",get_shadow_directory().c_str());
+ synfig::info("Created directory \"%s\"",get_shadow_directory().c_str());
}
}
{
}
-sinfg::String
+synfig::String
AutoRecover::get_shadow_directory()
{
return Glib::build_filename(App::get_user_app_directory(),"tmp");
// auto_backup_connect=App::main.get_context()->signal_timeout().connect(sigc::mem_fun(&AutoRecover::auto_backup),timeout);
}
-sinfg::String
-AutoRecover::get_shadow_file_name(const sinfg::String& filename)
+synfig::String
+AutoRecover::get_shadow_file_name(const synfig::String& filename)
{
unsigned int hash1(0xdeadbeef);
unsigned int hash2(0x83502529);
int status=0;
if(waitpid(pid,&status,WNOHANG)==-1)
{
- sinfg::info("PID %d isn't a zombie yet",pid);
+ synfig::info("PID %d isn't a zombie yet",pid);
return true;
}
if(WEXITSTATUS(status)!=0)
{
- sinfg::error("Autobackup seems to have failed! (PID=%d)",pid);
+ synfig::error("Autobackup seems to have failed! (PID=%d)",pid);
}
else
- sinfg::info("PID=%d has been cleaned up",pid);
+ synfig::info("PID=%d has been cleaned up",pid);
#endif
return false;
}
}
if(savecount)
- sinfg::info("AutoRecover::auto_backup(): %d Files backed up.",savecount);
+ synfig::info("AutoRecover::auto_backup(): %d Files backed up.",savecount);
}
catch(...)
{
- sinfg::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN.");
- sinfg::error("AutoRecover::auto_backup(): FILES NOT BACKED UP.");
+ synfig::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN.");
+ synfig::error("AutoRecover::auto_backup(): FILES NOT BACKED UP.");
}
#ifdef HAVE_FORK
}
void
-AutoRecover::clear_backup(sinfg::Canvas::Handle canvas)
+AutoRecover::clear_backup(synfig::Canvas::Handle canvas)
{
if(canvas)
remove(get_shadow_file_name(canvas->get_file_name()).c_str());