예제 #1
0
int
start_seafile_daemon ()
{
    applet_message ("Starting seaf-daemon ...\n");
    applet_message ("data dir:      %s\n", applet->seafile_dir);
    applet_message ("worktree dir:  %s\n", applet->seafile_worktree);

    char buf[4096];

    char *locale_config_dir = ccnet_locale_from_utf8(applet->config_dir);
    char *locale_seafile_dir = ccnet_locale_from_utf8(applet->seafile_dir);
    char *locale_seafile_worktree = ccnet_locale_from_utf8(applet->seafile_worktree);

    snprintf (buf, sizeof(buf), "seaf-daemon.exe -c \"%s\" -d \"%s\" -w \"%s\"",
              locale_config_dir, locale_seafile_dir, locale_seafile_worktree);

    g_free (locale_config_dir);
    g_free (locale_seafile_dir);
    g_free (locale_seafile_worktree);
    
    if (win32_spawn_process (buf, NULL) < 0) {
        applet_warning ("Failed to start seaf-daemon\n");
        applet_exit(-1);
    }

    return 0;
}
예제 #2
0
static gboolean
do_check_file_locked (const char *path, const char *worktree)
{
    char *real_path, *locale_path;
    HANDLE handle;

    real_path = g_build_path(PATH_SEPERATOR, worktree, path, NULL);
    locale_path = ccnet_locale_from_utf8(real_path);
    g_free (real_path);

    handle = CreateFile (locale_path,
                         GENERIC_WRITE,
                         0,
                         NULL,
                         OPEN_EXISTING,
                         0,
                         NULL);
    g_free (locale_path);
    if (handle != INVALID_HANDLE_VALUE) {
        CloseHandle (handle);
    } else if (GetLastError() == ERROR_SHARING_VIOLATION) {
        g_debug ("%s is locked.\n", locale_path);
        return TRUE;
    }

    return FALSE;
}
예제 #3
0
파일: utils.c 프로젝트: andrey-str/ccnet
static inline int
win_stat64_utf8 (char *path_u8, STAT_STRUCT *sb)
{
    char *path = ccnet_locale_from_utf8(path_u8);
    int result = _stat64(path, sb);
    g_free (path);
    return result;
}
예제 #4
0
int
ccnet_open_dir(const char *path)
{
    char *localpath = ccnet_locale_from_utf8(path);
    ShellExecute(0, "open", localpath, NULL, NULL, SW_SHOWNORMAL);
    g_free (localpath);
    return 0;
}
예제 #5
0
int 
spawn_ccnet_daemon ()
{
    if (!applet->config_dir)
        return -1;

    char buf[4096];
    char *locale_config_dir = ccnet_locale_from_utf8(applet->config_dir);

    snprintf (buf, sizeof(buf),
              "ccnet.exe -c \"%s\" -D Peer,Message,Connection,Other",
              locale_config_dir);

    g_free (locale_config_dir);

    if (win32_spawn_process (buf, NULL) < 0) {
        applet_warning ("Failed to fork ccnet.exe\n");
        return -1;
    }

    return 0;
}