XMMS2
|
00001 /* XMMS2 - X Music Multiplexer System 00002 * Copyright (C) 2003-2011 XMMS2 Team 00003 * 00004 * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!! 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 */ 00016 00017 /** @file 00018 * Miscellaneous internal utility functions. 00019 */ 00020 00021 #include <stdlib.h> 00022 #include <windows.h> 00023 #include <time.h> 00024 00025 #include "xmmsc/xmmsc_util.h" 00026 00027 /** 00028 * Get the absolute path to the user config dir. 00029 * 00030 * @param buf A char buffer 00031 * @param len The length of buf (XMMS_PATH_MAX is a good choice) 00032 * @return A pointer to buf, or NULL if an error occurred. 00033 */ 00034 const char * 00035 xmms_userconfdir_get (char *buf, int len) 00036 { 00037 char *config_home; 00038 00039 if (!buf || len <= 0) 00040 return NULL; 00041 00042 config_home = getenv ("APPDATA"); 00043 00044 if (config_home && *config_home) { 00045 snprintf (buf, len, "%s\\xmms2", config_home); 00046 00047 return buf; 00048 } 00049 00050 return NULL; 00051 } 00052 00053 00054 /** 00055 * Get the fallback connection path (if XMMS_PATH is not accessible) 00056 * 00057 * @param buf A char buffer 00058 * @param len The length of buf (XMMS_PATH_MAX is a good choice) 00059 * @return A pointer to buf, or NULL if an error occured. 00060 */ 00061 const char * 00062 xmms_fallback_ipcpath_get (char *buf, int len) 00063 { 00064 snprintf (buf, len, "tcp://127.0.0.1:" XMMS_STRINGIFY (XMMS_DEFAULT_TCP_PORT)); 00065 00066 return buf; 00067 } 00068 00069 /** 00070 * Sleep for n milliseconds. 00071 * 00072 * @param n The number of milliseconds to sleep. 00073 * @return true when we waited the full time, false otherwise. 00074 */ 00075 bool 00076 xmms_sleep_ms (int n) 00077 { 00078 Sleep (n); 00079 00080 return true; 00081 }