<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
- <cconfiguration id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760">
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760" moduleId="org.eclipse.cdt.core.settings" name="Build (GNU)">
+ <cconfiguration id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207" moduleId="org.eclipse.cdt.core.settings" name="Build (GNU)">
<externalSettings/>
<extensions>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
- <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
- <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactName="${ProjName}" buildProperties="" description="" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760" name="Build (GNU)" parent="org.eclipse.cdt.build.core.emptycfg">
- <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760.1254459493" name="/" resourcePath="">
- <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1057620081" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
- <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.1084930655" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
- <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.1173667006" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.1853089142" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
- <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.436034851" name="Name" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760" valueType="string"/>
+ <configuration buildProperties="" description="" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207" name="Build (GNU)" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207.1057170607" name="/" resourcePath="">
+ <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1245881488" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
+ <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.928517502" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
+ <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.1015570675" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.1719630296" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
+ <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1975512372" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207" valueType="string"/>
</tool>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.1944671241" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.806206756" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
- <option id="gnu.c.compiler.option.include.paths.868814188" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\glib-2.0""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\gtk-3.0""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\evolution-data-server-2.32""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\libgda-5.0""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\libgda-5.0\libgda""/>
- <listOptionValue builtIn="false" value=""C:\Users\a.zagli\Documents\development_environment_gtk3\mingw\include\gdk-pixbuf-2.0""/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.786662876" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1134244772" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
+ <option id="gnu.c.compiler.option.include.paths.960712418" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""H:\finestre_libere\sviluppo\development_environment_gtk3\mingw\include""/>
+ <listOptionValue builtIn="false" value=""H:\finestre_libere\sviluppo\development_environment_gtk3\mingw\include\glib-2.0""/>
+ <listOptionValue builtIn="false" value=""H:\finestre_libere\sviluppo\development_environment_gtk3\mingw\include\libgda-5.0""/>
+ <listOptionValue builtIn="false" value=""H:\finestre_libere\sviluppo\development_environment_gtk3\mingw\include\evolution-data-server-2.32""/>
</option>
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1147008075" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1050136525" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
- <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1763053076" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp"/>
+ <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.890585668" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp"/>
</toolChain>
</folderInfo>
</configuration>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <project id="libsolipa (gtk3).null.1736522599" name="libsolipa (gtk3)"/>
+ <project id="libsolipa (gtk3).null.1515999968" name="libsolipa (gtk3)"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
- <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760;org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760.1254459493;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.806206756;cdt.managedbuild.tool.gnu.c.compiler.input.1147008075">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- </scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2078941477;org.eclipse.linuxtools.cdt.autotools.core.toolChain.2078941477.912877605;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.2074081626;cdt.managedbuild.tool.gnu.c.compiler.input.1589342168">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207;org.eclipse.linuxtools.cdt.autotools.core.toolChain.1618029207.1057170607;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1134244772;cdt.managedbuild.tool.gnu.c.compiler.input.1050136525">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760;org.eclipse.linuxtools.cdt.autotools.core.toolChain.2086840760.1254459493;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.806206756;cdt.managedbuild.tool.gnu.c.compiler.input.1147008075">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
</storageModule>
</cproject>
return TRUE;
}
+static gint
+solipa_log_sort_filename (gconstpointer a,
+ gconstpointer b)
+{
+ const gchar *namea;
+ const gchar *nameb;
+
+ namea = g_file_info_get_name ((GFileInfo *)a);
+ nameb = g_file_info_get_name ((GFileInfo *)b);
+
+ /* la ordino al contrario */
+ /* TODO
+ * l'ordinamento deve essere non alphanumerico normale ma tenendo conto del numero del file
+ */
+ return (-1 * g_strcmp0 (namea, nameb));
+}
+
static void
solipa_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
{
if (priv->rotation_rotate > 0)
{
- GFile *fold;
+ GFile *fdir;
+ GFile *fold;
- fold = g_file_new_for_path (g_build_filename (g_file_get_path (g_file_get_parent (priv->file)), g_strdup_printf ("%s.0", priv->filename), NULL));
- g_file_delete (fold, NULL, NULL);
- g_object_unref (fold);
+ /* leggo la directory e ordino i file */
+ GFileEnumerator *enumdir;
- g_output_stream_close (G_OUTPUT_STREAM (priv->stream), NULL, NULL);
-
- fold = g_file_set_display_name (priv->file, g_strdup_printf ("%s.0", priv->filename), NULL, NULL);
- g_object_unref (priv->file);
- priv->file = g_object_ref (fold);
- g_object_unref (fold);
-
- if (priv->compress)
- {
- GZlibCompressor *compress;
- GOutputStream *ostreamcomp;
- GFile *fout;
- GFileInputStream *istream;
- GFileOutputStream *ostream;
+ fdir = g_file_get_parent (priv->file);
error = NULL;
- istream = g_file_read (priv->file, NULL, &error);
- if (istream == NULL || error != NULL)
+ enumdir = g_file_enumerate_children (fdir,
+ G_FILE_ATTRIBUTE_STANDARD_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &error);
+ if (enumdir == NULL || error != NULL)
{
- g_warning ("Impossibile leggere dal file %s: %s.",
- g_strdup_printf ("%s.0", priv->filename),
- error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ g_warning ("Impossibile leggere la directory dei log: %s.",
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
}
-
- buf = g_malloc0 (size);
-
- error = NULL;
- if (!g_input_stream_read_all (G_INPUT_STREAM (istream),
- buf,
- size,
- NULL,
- NULL,
- &error))
- {
- g_warning ("Impossibile leggere dallo stream: %s.",
- error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
- }
-
- fout = g_file_new_for_path (g_build_filename (g_file_get_path (g_file_get_parent (priv->file)), g_strdup_printf ("%s.0.gz", priv->filename), NULL));
- error = NULL;
- ostream = g_file_replace (fout,
- NULL,
- FALSE,
- G_FILE_CREATE_PRIVATE,
- NULL,
- &error);
- if (ostream == NULL || error != NULL)
+ else
{
- g_warning ("Impossibile creare il file: %s.",
- error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ GFileInfo *finfodir;
+ GSList *lstdir;
+ guint lstdir_size;
+ const gchar *filename;
+
+ GRegex *regex;
+ GMatchInfo *minfo;
+ gchar *numero;
+ gchar *str;
+
+ lstdir = NULL;
+ lstdir_size = 0;
+ while ((finfodir = g_file_enumerator_next_file (enumdir, NULL, NULL)) != NULL)
+ {
+ /* TODO
+ * deve includere solo i file che corrispondono alla regex
+ */
+ lstdir_size++;
+ lstdir = g_slist_prepend (lstdir, g_object_ref (finfodir));
+ }
+ g_file_enumerator_close (enumdir, NULL, NULL);
+
+ if (lstdir != NULL)
+ {
+ /* ordino la lista al contrario */
+ lstdir = g_slist_sort (lstdir, solipa_log_sort_filename);
+ }
+
+ error = NULL;
+ regex = g_regex_new (g_strdup_printf ("(%s\\.)(\\d+)(.*)", priv->filename), 0, 0, &error);
+ if (regex == NULL || error != NULL)
+ {
+ g_warning ("Error on creating regex: %s.",
+ error->message != NULL ? error->message : "no details");
+ }
+ else
+ {
+ do
+ {
+ finfodir = (GFileInfo *)lstdir->data;
+ filename = g_file_info_get_name (finfodir);
+
+ if (g_regex_match ((const GRegex *)regex,
+ filename,
+ 0,
+ &minfo))
+ {
+ fold = g_file_new_for_path (g_build_filename (g_file_get_path (fdir), filename, NULL));
+ if (lstdir_size >= priv->rotation_rotate)
+ {
+ /* elimino il file */
+ g_file_delete (fold, NULL, NULL);
+ lstdir_size--;
+ }
+ else
+ {
+ /* rinomino i file */
+ numero = g_match_info_fetch (minfo, 2);
+
+ error = NULL;
+ str = g_regex_replace ((const GRegex *)regex,
+ filename,
+ -1,
+ 0,
+ g_strdup_printf ("\\g<1>%d\\g<3>", strtol (numero, NULL, 10) + 1),
+ 0,
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Error on regex replacing: %s.",
+ error->message != NULL ? error->message : "no details");
+ g_regex_unref (regex);
+ }
+
+ g_file_set_display_name (fold, str, NULL, NULL);
+
+ g_object_unref (fold);
+
+ g_free (str);
+ g_free (numero);
+ g_match_info_free (minfo);
+ }
+ }
+ } while ((lstdir = g_slist_next (lstdir)) != NULL);
+ }
+ if (regex != NULL)
+ {
+ g_regex_unref (regex);
+ }
+
+ fold = g_file_new_for_path (g_build_filename (g_file_get_path (fdir), g_strdup_printf ("%s.0", priv->filename), NULL));
+ g_file_delete (fold, NULL, NULL);
+ g_object_unref (fold);
+
+ g_output_stream_close (G_OUTPUT_STREAM (priv->stream), NULL, NULL);
+
+ fold = g_file_set_display_name (priv->file, g_strdup_printf ("%s.0", priv->filename), NULL, NULL);
+ g_object_unref (priv->file);
+ priv->file = g_object_ref (fold);
+ g_object_unref (fold);
+
+ if (priv->compress)
+ {
+ GZlibCompressor *compress;
+ GOutputStream *ostreamcomp;
+ GFile *fout;
+ GFileInputStream *istream;
+ GFileOutputStream *ostream;
+
+ error = NULL;
+ istream = g_file_read (priv->file, NULL, &error);
+ if (istream == NULL || error != NULL)
+ {
+ g_warning ("Impossibile leggere dal file %s: %s.",
+ g_strdup_printf ("%s.0", priv->filename),
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ }
+
+ buf = g_malloc0 (size);
+
+ error = NULL;
+ if (!g_input_stream_read_all (G_INPUT_STREAM (istream),
+ buf,
+ size,
+ NULL,
+ NULL,
+ &error))
+ {
+ g_warning ("Impossibile leggere dallo stream: %s.",
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ }
+
+ fout = g_file_new_for_path (g_build_filename (g_file_get_path (g_file_get_parent (priv->file)), g_strdup_printf ("%s.0.gz", priv->filename), NULL));
+ error = NULL;
+ ostream = g_file_replace (fout,
+ NULL,
+ FALSE,
+ G_FILE_CREATE_PRIVATE,
+ NULL,
+ &error);
+ if (ostream == NULL || error != NULL)
+ {
+ g_warning ("Impossibile creare il file: %s.",
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ }
+
+ compress = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP,
+ -1);
+ ostreamcomp = g_converter_output_stream_new (G_OUTPUT_STREAM (ostream),
+ G_CONVERTER (compress));
+
+ error = NULL;
+ if (!g_output_stream_write_all (ostreamcomp,
+ buf,
+ size,
+ NULL,
+ NULL,
+ &error))
+ {
+ g_warning ("Impossibile creare il file: %s.",
+ error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
+ }
+
+ if (istream != NULL)
+ {
+ g_input_stream_close (G_INPUT_STREAM (istream), NULL, NULL);
+ g_object_unref (istream);
+ }
+ if (ostreamcomp != NULL)
+ {
+ g_output_stream_close (ostreamcomp, NULL, NULL);
+ g_object_unref (ostreamcomp);
+ }
+ if (ostream != NULL)
+ {
+ g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, NULL);
+ g_object_unref (ostream);
+ }
+
+ g_free (buf);
+
+ g_object_unref (fout);
+
+ g_file_delete (priv->file, NULL, NULL);
+ }
+
+ g_object_unref (priv->file);
}
-
- compress = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP,
- -1);
- ostreamcomp = g_converter_output_stream_new (G_OUTPUT_STREAM (ostream),
- G_CONVERTER (compress));
-
- error = NULL;
- if (!g_output_stream_write_all (ostreamcomp,
- buf,
- size,
- NULL,
- NULL,
- &error))
- {
- g_warning ("Impossibile creare il file: %s.",
- error != NULL && error->message != NULL ? error->message : "nessun dettaglio");
- }
-
- if (istream != NULL)
- {
- g_input_stream_close (G_INPUT_STREAM (istream), NULL, NULL);
- g_object_unref (istream);
- }
- if (ostreamcomp != NULL)
- {
- g_output_stream_close (ostreamcomp, NULL, NULL);
- g_object_unref (ostreamcomp);
- }
- if (ostream != NULL)
- {
- g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, NULL);
- g_object_unref (ostream);
- }
-
- g_free (buf);
-
- g_object_unref (fout);
-
- g_file_delete (priv->file, NULL, NULL);
- }
-
- g_object_unref (priv->file);
}
else
{
/* semplicemente lo elimino e ricreo */
+ g_output_stream_close (G_OUTPUT_STREAM (priv->stream), NULL, NULL);
g_file_delete (priv->file, NULL, NULL);
g_object_unref (priv->file);
}