@@ -337,9 +337,7 @@ bfile = joinpath(dir, "b.txt")
337337cp (afile, bfile)
338338
339339cfile = joinpath (dir, " c.txt" )
340- open (cfile, " w" ) do cf
341- write (cf, " This is longer than the contents of afile" )
342- end
340+ write (cfile, " This is longer than the contents of afile" )
343341cp (afile, cfile; remove_destination= true )
344342
345343a_stat = stat (afile)
@@ -410,13 +408,9 @@ if @unix? true : (Base.windows_version() >= Base.WINDOWS_VISTA_VER)
410408
411409 cfile = joinpath (srcdir, " c.txt" )
412410 file_txt = " This is some text with unicode - 这是一个文件"
413- open (cfile, " w" ) do cf
414- write (cf, file_txt)
415- end
411+ write (cfile, file_txt)
416412 hidden_cfile = joinpath (hidden_srcsubdir, " c.txt" )
417- open (hidden_cfile, " w" ) do cf
418- write (cf, file_txt)
419- end
413+ write (hidden_cfile, file_txt)
420414
421415 abs_dirlink_cp = joinpath (tmpdir, " abs_dirlink_cp" )
422416 hidden_srcsubdir_cp = joinpath (tmpdir, " .hidden_srcsubdir_cp" )
@@ -543,12 +537,9 @@ if @unix? true : (Base.windows_version() >= Base.WINDOWS_VISTA_VER)
543537 mkdir (subdir1)
544538
545539 cfile = abspath (joinpath (maindir, " c.txt" ))
546- open (cfile, " w" ) do cf
547- write (cf, " This is c.txt - 这是一个文件" )
548- end
549- open (abspath (joinpath (targetdir, " file1.txt" )), " w" ) do cf
550- write (cf, " This is file1.txt - 这是一个文件" )
551- end
540+ write (cfile, " This is c.txt - 这是一个文件" )
541+ write (abspath (joinpath (targetdir, " file1.txt" )),
542+ " This is file1.txt - 这是一个文件" )
552543
553544 abs_dl = joinpath (maindir, " abs_linkto_targetdir" )
554545 symlink (targetdir, abs_dl)
616607 srcfile_new = joinpath (tmpdir, " srcfile_new.txt" )
617608 hidden_srcfile_new = joinpath (tmpdir, " .hidden_srcfile_new.txt" )
618609 file_txt = " This is some text with unicode - 这是一个文件"
619- open (srcfile, " w" ) do f
620- write (f, file_txt)
621- end
622- open (hidden_srcfile, " w" ) do f
623- write (f, file_txt)
624- end
610+ write (srcfile, file_txt)
611+ write (hidden_srcfile, file_txt)
625612 abs_filelink = joinpath (tmpdir, " abs_filelink" )
626613 symlink (abspath (srcfile), abs_filelink)
627614 cd (tmpdir)
701688 # Test remove the existing path first and copy an other file
702689 otherfile = joinpath (tmpdir, " otherfile.txt" )
703690 otherfile_content = " This is otherfile.txt with unicode - 这是一个文件"
704- open (otherfile, " w" ) do f
705- write (f, otherfile_content)
706- end
691+ write (otherfile, otherfile_content)
707692 for d in test_new_paths1
708693 cp (otherfile, d; remove_destination= true , follow_symlinks= false )
709694 # Expect no link because a file is copied (follow_symlinks=false does not effect this)
753738 mkdir (subdir1)
754739
755740 cfile = abspath (joinpath (maindir, " c.txt" ))
756- open (cfile, " w" ) do cf
757- write (cf, " This is c.txt - 这是一个文件" )
758- end
759- open (abspath (joinpath (targetdir, " file1.txt" )), " w" ) do cf
760- write (cf, " This is file1.txt - 这是一个文件" )
761- end
741+ write (cfile, " This is c.txt - 这是一个文件" )
742+ write (abspath (joinpath (targetdir, " file1.txt" )),
743+ " This is file1.txt - 这是一个文件" )
762744
763745 abs_fl = joinpath (maindir, " abs_linkto_c.txt" )
764746 symlink (cfile, abs_fl)
0 commit comments