~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/prefix.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Ted Gould, Kees Cook
  • Date: 2009-06-24 14:00:43 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624140043-07stp20mry48hqup
Tags: 0.47~pre0-0ubuntu1
* New upstream release

[ Ted Gould ]
* debian/control: Adding libgsl0 and removing version specifics on boost

[ Kees Cook ]
* debian/watch: updated to run uupdate and mangle pre-release versions.
* Dropped patches that have been taken upstream:
  - 01_mips
  - 02-poppler-0.8.3
  - 03-chinese-inkscape
  - 05_fix_latex_patch
  - 06_gcc-4.4
  - 07_cdr2svg
  - 08_skip-bad-utf-on-pdf-import
  - 09_gtk-clist
  - 10_belarussian
  - 11_libpng
  - 12_desktop
  - 13_slider
  - 100_svg_import_improvements
  - 102_sp_pattern_painter_free
  - 103_bitmap_type_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#include <limits.h>
46
46
#include "prefix.h"
47
47
 
 
48
 
48
49
#ifdef __cplusplus
49
50
extern "C" {
50
51
#endif /* __cplusplus */
355
356
char *
356
357
br_extract_dir (const char *path)
357
358
{
358
 
        char *end, *result;
 
359
        const char *end;
 
360
        char *result;
359
361
 
360
362
        br_return_val_if_fail (path != (char*)NULL, (char*)NULL);
361
363
 
390
392
char *
391
393
br_extract_prefix (const char *path)
392
394
{
393
 
        char *end, *tmp, *result;
 
395
        const char *end;
 
396
        char *tmp, *result;
394
397
 
395
398
        br_return_val_if_fail (path != (char*)NULL, (char*)NULL);
396
399
 
424
427
}
425
428
#endif /* __cplusplus */
426
429
 
 
430
 
 
431
 
 
432
#ifdef __WIN32__
 
433
 
 
434
/**
 
435
 * Provide a similar mechanism for Win32.  Enable a macro,
 
436
 * WIN32_DATADIR, that can look up subpaths for inkscape resources 
 
437
 */ 
 
438
 
 
439
#include <windows.h>
 
440
#include <glibmm/ustring.h>
 
441
 
 
442
/**
 
443
 * Return the directory of the .exe that is currently running
 
444
 */
 
445
static Glib::ustring win32_getExePath()
 
446
{
 
447
    char exeName[MAX_PATH+1];
 
448
    GetModuleFileName(NULL, exeName, MAX_PATH);
 
449
    char *slashPos = strrchr(exeName, '\\');
 
450
    if (slashPos)
 
451
        *slashPos = '\0';
 
452
    Glib::ustring s = exeName;
 
453
    return s;
 
454
}
 
455
 
 
456
 
 
457
/**
 
458
 * Return the relocatable version of the datadir,
 
459
 * probably c:\inkscape 
 
460
 */
 
461
static Glib::ustring win32_getDataDir()
 
462
{
 
463
    Glib::ustring dir = win32_getExePath();
 
464
    if (INKSCAPE_DATADIR  && *INKSCAPE_DATADIR &&
 
465
            strcmp(INKSCAPE_DATADIR, ".") != 0)
 
466
        {
 
467
        dir += "\\";
 
468
        dir += INKSCAPE_DATADIR;
 
469
        }
 
470
    return dir;
 
471
}
 
472
 
 
473
static Glib::ustring win32_getResourcePath(const Glib::ustring &childPath)
 
474
{
 
475
    Glib::ustring dir = win32_getDataDir();
 
476
    if (childPath.size() > 0)
 
477
        {
 
478
        dir += "\\";
 
479
        dir += childPath;
 
480
        }
 
481
    return dir;
 
482
}
 
483
 
 
484
 
 
485
/**
 
486
 * This is the visible utility function
 
487
 */ 
 
488
char *win32_relative_path(const char *childPath)
 
489
{
 
490
    static char *returnPath = NULL;
 
491
    if (!childPath)
 
492
        childPath = "";
 
493
    Glib::ustring resourcePath = win32_getResourcePath(childPath);
 
494
    if (returnPath)
 
495
        free(returnPath);
 
496
    returnPath = strdup(resourcePath.c_str());
 
497
    return returnPath;
 
498
}
 
499
#endif /* __WIN32__ */
 
500
 
 
501
 
 
502
 
 
503
 
427
504
#endif /* _PREFIX_C */