summary refs log tree commit diff stats
path: root/doc/pydoc/make_doc.html
blob: fb04ba47abbe1fd1fb093f0aa42c2fcc360caa4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module make_doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>make_doc</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/make_doc.py">/home/hut/work/ranger/make_doc.py</a></font></td></tr></table>
    <p><tt>Generate&nbsp;pydoc&nbsp;documentation&nbsp;and&nbsp;move&nbsp;it&nbsp;to&nbsp;the&nbsp;doc&nbsp;directory.<br>
THIS&nbsp;WILL&nbsp;DELETE&nbsp;ALL&nbsp;EXISTING&nbsp;HTML&nbsp;FILES&nbsp;IN&nbsp;THAT&nbsp;DIRECTORY,&nbsp;so&nbsp;don't<br>
store&nbsp;important&nbsp;content&nbsp;there.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="pydoc.html">pydoc</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table>
</body></html>
nf">files_get_chatlog_dir(void) { gchar *xdg_data =_xdg_get_data_home(); GString *chatlogs_dir = g_string_new(xdg_data); g_string_append(chatlogs_dir, "/profanity/chatlogs"); gchar *result = strdup(chatlogs_dir->str); g_free(xdg_data); g_string_free(chatlogs_dir, TRUE); return result; } gchar * files_get_preferences_file(void) { gchar *xdg_config = _xdg_get_config_home(); GString *prefs_file = g_string_new(xdg_config); g_string_append(prefs_file, "/profanity/profrc"); gchar *result = strdup(prefs_file->str); g_free(xdg_config); g_string_free(prefs_file, TRUE); return result; } gchar * files_get_log_file(void) { gchar *xdg_data = _xdg_get_data_home(); GString *logfile = g_string_new(xdg_data); g_string_append(logfile, "/profanity/logs/profanity.log"); gchar *result = strdup(logfile->str); g_free(xdg_data); g_string_free(logfile, TRUE); return result; } gchar * files_get_accounts_file(void) { gchar *xdg_data = _xdg_get_data_home(); GString *logfile = g_string_new(xdg_data); g_string_append(logfile, "/profanity/accounts"); gchar *result = strdup(logfile->str); g_free(xdg_data); g_string_free(logfile, TRUE); return result; } gchar * files_get_themes_dir(void) { gchar *xdg_config = _xdg_get_config_home(); GString *themes_dir = g_string_new(xdg_config); g_string_append(themes_dir, "/profanity/themes"); gchar *result = strdup(themes_dir->str); g_free(xdg_config); g_string_free(themes_dir, TRUE); return result; } static void _files_create_config_directory(void) { gchar *xdg_config = _xdg_get_config_home(); GString *prof_conf_dir = g_string_new(xdg_config); g_string_append(prof_conf_dir, "/profanity"); _mkdir_recursive(prof_conf_dir->str); g_free(xdg_config); g_string_free(prof_conf_dir, TRUE); } static void _files_create_data_directory(void) { gchar *xdg_data = _xdg_get_data_home(); GString *prof_data_dir = g_string_new(xdg_data); g_string_append(prof_data_dir, "/profanity"); _mkdir_recursive(prof_data_dir->str); g_free(xdg_data); g_string_free(prof_data_dir, TRUE); } static void _files_create_chatlog_directory(void) { gchar *xdg_data = _xdg_get_data_home(); GString *chatlogs_dir = g_string_new(xdg_data); g_string_append(chatlogs_dir, "/profanity/chatlogs"); _mkdir_recursive(chatlogs_dir->str); g_free(xdg_data); g_string_free(chatlogs_dir, TRUE); } static void _files_create_log_directory(void) { gchar *xdg_data = _xdg_get_data_home(); GString *chatlogs_dir = g_string_new(xdg_data); g_string_append(chatlogs_dir, "/profanity/logs"); _mkdir_recursive(chatlogs_dir->str); g_free(xdg_data); g_string_free(chatlogs_dir, TRUE); } static void _files_create_themes_directory(void) { gchar *xdg_config = _xdg_get_config_home(); GString *themes_dir = g_string_new(xdg_config); g_string_append(themes_dir, "/profanity/themes"); _mkdir_recursive(themes_dir->str); g_free(xdg_config); g_string_free(themes_dir, TRUE); } static void _create_dir(char *name) { int e; struct stat sb; e = stat(name, &sb); if (e != 0) if (errno == ENOENT) e = mkdir(name, S_IRWXU); } static void _mkdir_recursive(const char *dir) { int i; for (i = 1; i <= strlen(dir); i++) { if (dir[i] == '/' || dir[i] == '\0') { gchar *next_dir = g_strndup(dir, i); _create_dir(next_dir); g_free(next_dir); } } } static gchar * _xdg_get_config_home(void) { gchar *xdg_config_home = getenv("XDG_CONFIG_HOME"); if (xdg_config_home != NULL) g_strstrip(xdg_config_home); if ((xdg_config_home != NULL) && (strcmp(xdg_config_home, "") != 0)) { return strdup(xdg_config_home); } else { GString *default_path = g_string_new(getenv("HOME")); g_string_append(default_path, "/.config"); gchar *result = strdup(default_path->str); g_string_free(default_path, TRUE); return result; } } static gchar * _xdg_get_data_home(void) { gchar *xdg_data_home = getenv("XDG_DATA_HOME"); if (xdg_data_home != NULL) g_strstrip(xdg_data_home); if ((xdg_data_home != NULL) && (strcmp(xdg_data_home, "") != 0)) { return strdup(xdg_data_home); } else { GString *default_path = g_string_new(getenv("HOME")); g_string_append(default_path, "/.local/share"); gchar *result = strdup(default_path->str); g_string_free(default_path, TRUE); return result; } }