Coverage for grm\lib\File_Class.py: 38%

24 statements  

« prev     ^ index     » next       coverage.py v7.2.3, created at 2023-04-10 14:44 +0900

1# -*- coding: utf-8 -*- 

2import os 

3from subprocess import Popen 

4 

5# 2019-04-05 박: 프로그램 개발에 앞서 내부 모듈에서 사용하는 함수 정리해두기 

6 

7 

8# 파일 존재 여부 체크 함수 

9def ChFile_Exists(file): 

10 return os.path.exists(file) 

11 

12 

13# 파일 이름 반환 함수 

14def GetFile_Name(file): 

15 # FileName = os.path.splitext(file)[0] 

16 FileName = os.path.splitext(os.path.basename(file))[0] 

17 return FileName 

18 

19 

20# 파일폴더 경로 반환 

21def GetFileDirectory_Path(file): 

22 return os.path.dirname(file) 

23 

24 

25# python 프로그램의 실행 경로를 받아옴 

26def GetScriptDirectory_Path(): 

27 scriptDirectory = os.path.dirname(os.path.realpath(__file__)).replace("lib", "") 

28 return scriptDirectory 

29 

30 

31# 파일 전체를 읽어서 파일 내용을 반환 

32def GetRead_Txt(file): 

33 f = open(file, "r") 

34 AllText = f.read() 

35 f.close() 

36 return AllText 

37 

38 

39# 폴더 경로 맞는지 확인 

40def CheckFolder(path): 

41 filepath = path.replace("\\", "\\\\") 

42 if os.path.isdir(filepath): 

43 return True 

44 else: 

45 return False 

46 

47 

48def callExecute(arg): 

49 result = Popen(arg, shell=True)