is_writable_dir.pro

来自「IDL语言编写的用于天文自适应光学仿真的软件CAOS V6.0的第一部分。」· PRO 代码 · 共 31 行

PRO
31
字号
; $Id: is_writable_dir.pro,v 1.2 2002/03/14 11:49:12 riccardi Exp $

;+
;
; NAME
;
;    IS_WRITABLE_DIR
;
; SYNTAX
;
;    ret = is_writable_dir(dirname)
;
; dirname: scalar string containing the directory name to test.
;
; ret:     scalar byte. 1B if it is possible to write in dirname. 0B otherwise.
;
; April 1999, written by A. Riccardi (OAA) <riccardi@arcetri.astro.it>
;-
function is_writable_dir, dirname

;; try to open a temporary file
filename = filepath("tmp"+strtrim(long(systime(1)),2), ROOT=dirname)
openw, unit, filename, /GET_LUN, ERROR=error, /DELETE

is_writable = error eq 0

if is_writable then free_lun, unit

return, is_writable
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?