mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os.File clean up + socket.v (dial())
This commit is contained in:
10
vlib/os/os.v
10
vlib/os/os.v
@@ -188,7 +188,7 @@ fn create_file2(file, mode string) File {
|
||||
return res
|
||||
}
|
||||
|
||||
fn (f File) append(s string) {
|
||||
pub fn (f File) write(s string) {
|
||||
ss := s.clone()
|
||||
C.fputs(ss.cstr(), f.cfile)
|
||||
// ss.free()
|
||||
@@ -208,7 +208,7 @@ fn (f File) write_bytes_at(data voidptr, size, pos int) {
|
||||
C.fseek(f.cfile, 0, SEEK_END)
|
||||
}
|
||||
|
||||
pub fn (f File) appendln(s string) {
|
||||
pub fn (f File) writeln(s string) {
|
||||
// C.fwrite(s.str, 1, s.len, f.cfile)
|
||||
// ss := s.clone()
|
||||
// TODO perf
|
||||
@@ -446,7 +446,7 @@ pub fn home_dir() string {
|
||||
// write_file writes text data to a file in `path`.
|
||||
pub fn write_file(path, text string) {
|
||||
f := os.create(path)
|
||||
f.appendln(text)
|
||||
f.writeln(text)
|
||||
f.close()
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ pub fn is_dir(path string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn chdir(path string) {
|
||||
pub fn chdir(path string) {
|
||||
$if windows {
|
||||
C._chdir(path.cstr())
|
||||
}
|
||||
@@ -555,7 +555,7 @@ pub fn ls(path string) []string {
|
||||
fn log(s string) {
|
||||
}
|
||||
|
||||
fn print_backtrace() {
|
||||
pub fn print_backtrace() {
|
||||
/*
|
||||
# void *buffer[100];
|
||||
nptrs := 0
|
||||
|
||||
Reference in New Issue
Block a user