On Tue, Jul 3, 2012 at 6:22 AM, Fabiano Fidêncio <fabiano@xxxxxxxxxxxx> wrote: > ---------- Forwarded message ---------- > From: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx> > Date: Sun, Jul 1, 2012 at 4:36 PM > Subject: Re: [PATCH 09/10] Change > osinfo_install_script_generate to write the output in a file > To: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > > On Wed, Jun 13, 2012 at 7:35 AM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote: >> On Mon, Jun 11, 2012 at 11:23:10PM -0300, Fabiano Fidêncio wrote: >>> For libosinfo API: >>> Now, instead of return a string, writes that string in a file, >>> passed as argument >>> >>> For osinfo-install-script tool: >>> The output will be wrote in: >>> - Linuxes: <short_id>,ks >>> - Windows 2k3r2 and older: windows.sif >>> - Windows 2k8 and newer: windows.xml >>> >>> It will be used to create, easily, multiple scripts, as used in: >>> http://bugzilla-attachments.gnome.org/attachment.cgi?id=214681 >> >> I was a bit dubious about this one at first, but seeing what you >> needed to do with the windows scripts, I understand now. >> >> If we follow my suggestion, of actually putting the required >> filename in the XML metadata, this API will need to change >> slightly too. > > Sorry, It is not so clear to me. How could I set/get the filename in the XML? > Example: <template filename=<xsl:value-of select="config/filename"/>>? > Didn't test but I think I can't do this. > >> >>> +gboolean osinfo_install_script_generate(OsinfoInstallScript *script, >>> + OsinfoOs *os, >>> + OsinfoInstallConfig *config, >>> + gchar *path, >>> + GCancellable *cancellable, >>> + GError **error); >> >> >> I'd suggest it should take a 'GFile *outputdir' parameter, >> and then for each template filename listed in the XML, >> we generate 'outputdir/filename'. Using GFile is preferrable >> to gchar *path, since then we're not tied to local paths - apps >> can use any URI scheme supported by GIO. > > Thinking here, we really need this change? > osinfo_install_script_generate can just return the string. Why? > Because it is what the apps will use, commonly. For that you can create add a utility function osinfo_install_script_generate_to_path() that creates the GFile from the path, calls osinfo_install_script_generate and then frees the GFile. Whats more important for apps is for all these I/O functions to have async variants. -- Regards, Zeeshan Ali (Khattak) FSF member#5124