1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: replace os.base_dir with os.dir

This commit is contained in:
Alexander Medvednikov 2020-10-01 01:30:22 +02:00
parent 4879661f5a
commit f534edc371
3 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,7 @@ const (
exe_path = os.executable() exe_path = os.executable()
exe_dir = os.dir(exe_path) exe_dir = os.dir(exe_path)
res_path = os.join_path(exe_dir, 'vdoc-resources') res_path = os.join_path(exe_dir, 'vdoc-resources')
vexe_path = os.base_dir(@VEXE) vexe_path = os.dir(@VEXE)
html_content = ' html_content = '
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -440,7 +440,7 @@ fn write_toc(cn doc.DocNode, nodes []doc.DocNode, mut toc strings.Builder) {
} }
fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, mut hw strings.Builder) { fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, mut hw strings.Builder) {
base_dir := os.base_dir(os.real_path(cfg.input_path)) base_dir := os.dir(os.real_path(cfg.input_path))
file_path_name := if cfg.is_multi { cn.file_path.replace('$base_dir/', '') } else { os.file_name(cn.file_path) } file_path_name := if cfg.is_multi { cn.file_path.replace('$base_dir/', '') } else { os.file_name(cn.file_path) }
src_link := get_src_link(cfg.manifest.repo_url, file_path_name, cn.pos.line) src_link := get_src_link(cfg.manifest.repo_url, file_path_name, cn.pos.line)
children := dcs.contents.find_children_of(cn.name) children := dcs.contents.find_children_of(cn.name)
@ -702,7 +702,7 @@ fn (mut cfg DocConfig) generate_docs_from_file() {
} else if os.is_dir(cfg.input_path) { } else if os.is_dir(cfg.input_path) {
cfg.input_path cfg.input_path
} else { } else {
os.base_dir(cfg.input_path) os.dir(cfg.input_path)
} }
manifest_path := os.join_path(dir_path, 'v.mod') manifest_path := os.join_path(dir_path, 'v.mod')
if os.exists(manifest_path) { if os.exists(manifest_path) {
@ -877,7 +877,7 @@ fn get_ignore_paths(path string) ?[]string {
fn lookup_module(mod string) ?string { fn lookup_module(mod string) ?string {
mod_path := mod.replace('.', os.path_separator) mod_path := mod.replace('.', os.path_separator)
compile_dir := os.real_path(os.base_dir('.')) compile_dir := os.real_path(os.dir('.'))
modules_dir := os.join_path(compile_dir, 'modules', mod_path) modules_dir := os.join_path(compile_dir, 'modules', mod_path)
vlib_path := os.join_path(vexe_path, 'vlib', mod_path) vlib_path := os.join_path(vexe_path, 'vlib', mod_path)
vmodules_path := os.join_path(os.home_dir(), '.vmodules', mod_path) vmodules_path := os.join_path(os.home_dir(), '.vmodules', mod_path)

View File

@ -51,7 +51,7 @@ pub fn (mut l Log) set_output_level(level Level) {
pub fn (mut l Log) set_full_logpath(full_log_path string) { pub fn (mut l Log) set_full_logpath(full_log_path string) {
rlog_file := os.real_path(full_log_path) rlog_file := os.real_path(full_log_path)
l.set_output_label(os.file_name(rlog_file)) l.set_output_label(os.file_name(rlog_file))
l.set_output_path(os.base_dir(rlog_file)) l.set_output_path(os.dir(rlog_file))
} }
pub fn (mut l Log) set_output_label(label string) { pub fn (mut l Log) set_output_label(label string) {

View File

@ -257,7 +257,7 @@ fn get_parent_mod(dir string) ?string {
return error('root folder reached') return error('root folder reached')
} }
} }
base_dir := os.base_dir(dir) base_dir := os.dir(dir)
fname_base_dir := os.file_name(base_dir) fname_base_dir := os.file_name(base_dir)
prefs := new_vdoc_preferences() prefs := new_vdoc_preferences()
fentries := os.ls(base_dir) or { fentries := os.ls(base_dir) or {
@ -420,7 +420,7 @@ fn (mut d Doc) expr_typ_to_string(ex ast.Expr) string {
fn (mut d Doc) generate() ?Doc { fn (mut d Doc) generate() ?Doc {
// get all files // get all files
base_path := if os.is_dir(d.input_path) { d.input_path } else { os.real_path(os.base_dir(d.input_path)) } base_path := if os.is_dir(d.input_path) { d.input_path } else { os.real_path(os.dir(d.input_path)) }
d.is_vlib = 'vlib' !in base_path d.is_vlib = 'vlib' !in base_path
project_files := os.ls(base_path) or { project_files := os.ls(base_path) or {
return error_with_code(err, 0) return error_with_code(err, 0)