cafe_basics_duo 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_basics_duo.rb +42 -19
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33f4b908df61a07411dbba0ed67ade34e086cb6723fe9c74ee571dde72a849f9
4
- data.tar.gz: b2358bac0410d89ee8eb3795b13ec2d9851ce183b37ee1472384eaf52364b2e8
3
+ metadata.gz: ccaaca7ab7260950d6ee2d342ad539f95386196976ed6a6c3675562f094448d6
4
+ data.tar.gz: d5427262d21ded00f1ae08f94842fb03725d10118a4dc60dc9babb35355ce89d
5
5
  SHA512:
6
- metadata.gz: 526909dc9b26c11397a62a5e09bdbbe2bc163dc9ec5646658174cfedda4e5a26b47c9d3f881e077e42e9d875388c489ab3e25a0a40e190f70962cb45dc3fc335
7
- data.tar.gz: 58e0da7c66763fd5ebcc7de28f8508be9c62ff6fecace712973a9fe1e12bb671d661fffa11dd1ed6cf14572ae64ac942e15532d1283c19e312526836ff70e3b5
6
+ metadata.gz: 48f9a541aa2232bf42ca2afa613751a29aa7928c8178f912b962bac9b31eebbe3d15ac05a9139aa2b145cd4387c8645f57e53e2e8b016f55cecbaaabdb2b5df1
7
+ data.tar.gz: 2f0818b594ee2f2b09813d42953ad805b037657cc787c26578611ba823f026976b178cbf7fbdd8cf6aaae5111d878c31583e954afb9663629ae5312a08c613a7
@@ -3787,20 +3787,34 @@ class Wordpress
3787
3787
  stretchy false
3788
3788
  text "내용폴더경로 ex)C:\\내용\\폴더1"
3789
3789
  }
3790
- button('폴더째로 불러오기'){
3791
-
3792
- on_clicked{
3793
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3794
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
3795
- if file == '.' or file == '..'
3790
+ button('폴더째로 불러오기') {
3791
+ on_clicked {
3792
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
3796
3793
 
3797
- else
3798
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
3799
- @data['내용설정']['내용'] << [false, file, file_data]
3794
+ # 경로가 유효한지 확인
3795
+ if Dir.exist?(path)
3796
+ Dir.entries(path).each do |file|
3797
+ if file == '.' or file == '..'
3798
+ next
3799
+ else
3800
+ begin
3801
+ # 파일을 열고 내용을 읽어서 추가
3802
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
3803
+ @data['내용설정']['내용'] << [false, file, file_data]
3804
+ rescue => e
3805
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
3806
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
3807
+ end
3808
+ end
3800
3809
  end
3810
+
3811
+ # 내용 배열에서 마지막 빈 항목 제거
3812
+ @data['내용설정']['내용'] << []
3813
+ @data['내용설정']['내용'].pop
3814
+ else
3815
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
3816
+ puts "경로가 존재하지 않습니다: #{path}"
3801
3817
  end
3802
- @data['내용설정']['내용'] << []
3803
- @data['내용설정']['내용'].pop
3804
3818
  }
3805
3819
  }
3806
3820
  }
@@ -3885,22 +3899,31 @@ class Wordpress
3885
3899
  stretchy false
3886
3900
  text "사진폴더경로 ex)C:\\사진\\폴더2"
3887
3901
  }
3888
- button('폴더째로불러오기'){
3889
-
3890
- on_clicked{
3891
- path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3892
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
3893
- if file == '.' or file == '..'
3902
+ button('폴더째로 불러오기') {
3903
+ on_clicked {
3904
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
3894
3905
 
3906
+ # 경로가 유효한지 확인
3907
+ if Dir.exist?(path)
3908
+ Dir.entries(path).each do |file|
3909
+ if file == '.' or file == '..'
3910
+ next
3895
3911
  else
3896
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
3912
+ # 폴더 내의 파일을 이미지 리스트에 추가
3913
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
3897
3914
  end
3898
3915
  end
3916
+
3917
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
3899
3918
  @data['이미지설정']['이미지'] << []
3900
3919
  @data['이미지설정']['이미지'].pop
3901
- }
3920
+ else
3921
+ # 경로가 존재하지 않으면 경고 메시지 출력
3922
+ puts "경로가 존재하지 않습니다: #{path}"
3923
+ end
3902
3924
  }
3903
3925
  }
3926
+ }
3904
3927
 
3905
3928
  }
3906
3929
  vertical_separator{
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com