[PATCH 3/3] Open CSV files only via the GUI

Henrik Brautaset Aronsen henrik at synth.no
Thu Oct 17 13:02:46 UTC 2013


  ... but if the CSV file has sane header names we should be able to import
directly, I guess?

H
-- 
Sent from my phone
17. okt. 2013 21:05 skrev "Miika Turkia" <miika.turkia at gmail.com> følgende:

> Since the CSV import transformation is now parametrized and does not
> have any defaults, we need to use the CSV import GUI. Thus give an error
> message if one is opening CSV file directly.
>
> Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> ---
>  file.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/file.c b/file.c
> index acabd1b..39d9a25 100644
> --- a/file.c
> +++ b/file.c
> @@ -260,8 +260,12 @@ static int open_by_filename(const char *filename,
> const char *fmt, struct memblo
>                 return try_to_open_zip(filename, mem, error);
>
>         /* CSV files */
> -       if (!strcasecmp(fmt, "CSV"))
> -               return try_to_xslt_open_csv(filename, mem, error);
> +       if (!strcasecmp(fmt, "CSV")) {
> +               int len = strlen(translate("gettextFromC","Failed to read
> '%s'. Use import for CSV files.")) + strlen(filename);
> +               *error = malloc(len);
> +               snprintf(*error, len, translate("gettextFromC","Failed to
> read '%s'. Use import for CSV files."), filename);
> +               return 1;
> +       }
>
>  #if ONCE_COCHRAN_IS_SUPPORTED
>         /* Truly nasty intentionally obfuscated Cochran Anal software */
> --
> 1.8.1.2
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20131017/95fcdba5/attachment.html>


More information about the subsurface mailing list