~ubuntu-branches/ubuntu/saucy/glib2.0/saucy-proposed

« back to all changes in this revision

Viewing changes to .pc/04_homedir_env.patch/glib/gutils.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-08-21 10:08:49 UTC
  • mfrom: (1.63.24)
  • Revision ID: package-import@ubuntu.com-20130821100849-enhti9o2tk0iug5r
Tags: 2.37.6-1ubuntu1
* Resynchronise with Debian, remaining change:
  - Build-Depend on python:any for cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
954
954
/**
955
955
 * g_get_tmp_dir:
956
956
 *
957
 
 * Gets the directory to use for temporary files. This is found from 
958
 
 * inspecting the environment variables <envar>TMPDIR</envar>, 
959
 
 * <envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none 
960
 
 * of those are defined "/tmp" is returned on UNIX and "C:\" on Windows. 
961
 
 * The encoding of the returned string is system-defined. On Windows, 
962
 
 * it is always UTF-8. The return value is never %NULL or the empty string.
 
957
 * Gets the directory to use for temporary files.
 
958
 *
 
959
 * On UNIX, this is taken from the <envar>TMPDIR</envar> environment
 
960
 * variable.  If the variable is not set, <literal>P_tmpdir</literal> is
 
961
 * used, as defined by the system C library.  Failing that, a hard-coded
 
962
 * default of "/tmp" is returned.
 
963
 *
 
964
 * On Windows, the <envar>TEMP</envar> environment variable is used,
 
965
 * with the root directory of the Windows installation (eg: "C:\") used
 
966
 * as a default.
 
967
 *
 
968
 * The encoding of the returned string is system-defined. On Windows, it
 
969
 * is always UTF-8. The return value is never %NULL or the empty string.
963
970
 *
964
971
 * Returns: the directory to use for temporary files.
965
972
 */
972
979
    {
973
980
      gchar *tmp;
974
981
 
 
982
#ifdef G_OS_WIN32
 
983
      tmp = g_strdup (g_getenv ("TEMP"));
 
984
 
 
985
      if (tmp == NULL || *tmp == '\0')
 
986
        {
 
987
          g_free (tmp);
 
988
          tmp = get_windows_directory_root ();
 
989
        }
 
990
#else /* G_OS_WIN32 */
975
991
      tmp = g_strdup (g_getenv ("TMPDIR"));
976
992
 
977
 
      if (tmp == NULL || *tmp == '\0')
978
 
        {
979
 
          g_free (tmp);
980
 
          tmp = g_strdup (g_getenv ("TMP"));
981
 
        }
982
 
 
983
 
      if (tmp == NULL || *tmp == '\0')
984
 
        {
985
 
          g_free (tmp);
986
 
          tmp = g_strdup (g_getenv ("TEMP"));
987
 
        }
988
 
 
989
 
#ifdef G_OS_WIN32
990
 
      if (tmp == NULL || *tmp == '\0')
991
 
        {
992
 
          g_free (tmp);
993
 
          tmp = get_windows_directory_root ();
994
 
        }
995
 
#else
996
 
 
997
993
#ifdef P_tmpdir
998
994
      if (tmp == NULL || *tmp == '\0')
999
995
        {
1004
1000
          if (k > 1 && G_IS_DIR_SEPARATOR (tmp[k - 1]))
1005
1001
            tmp[k - 1] = '\0';
1006
1002
        }
1007
 
#endif
 
1003
#endif /* P_tmpdir */
1008
1004
 
1009
1005
      if (tmp == NULL || *tmp == '\0')
1010
1006
        {