backlink_zon 0.0.3 → 0.0.7

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/backlink_zon.rb +42 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1fb5fada83fc26a7e17dafa78cc3c03ed60d77fda229c5b546edf5546d4cc98
4
- data.tar.gz: 555ca0dae00a1a1ba7dc76fd9f391315256ec33db059b40779a9603a1be6d524
3
+ metadata.gz: db63e71f1e682dad48646eba57eeb254e32cc95979b1e672d430c9d9d80065a8
4
+ data.tar.gz: 01ac91719959a590386120f7e8d1a6ded7610a6edcc84f5a401dbd28b8d85f84
5
5
  SHA512:
6
- metadata.gz: 374282c39c792a8b2a04fd9e0662981be0696251052160ede68e4f4a4cfb815e8bddc42b3ae502be71ca81c14575221a4697eebe40d25ce89e9351ebf0a8cac0
7
- data.tar.gz: 4c98be57a6ac071d06fff5867936c7cfe86a27593c36cd41a3742bcccd41842d17030721d9c00672e49bc0646a006a5ea6aca597b4827cd17381ead92e38e5cd
6
+ metadata.gz: eb4bc5a043084bd2953960440c75ff868e5bc81d1b4808951783c40321c153b6b1cef7b5d16c4d63ab67937e24cf01bda48581bcb73163b392519f057aa76d66
7
+ data.tar.gz: 93510928be69a908b5800aa83189b0f52dff77217312c571dce3936a2f16bdd1fcf7fc4d2a6599674b3cc705245e71f26769c6e4b916ebb65ac729e709a0a5aa
data/lib/backlink_zon.rb CHANGED
@@ -2063,18 +2063,33 @@ class Wordpress
2063
2063
  }
2064
2064
  button('폴더째로불러오기'){
2065
2065
  stretchy false
2066
- on_clicked{
2067
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2068
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
2069
- if file == '.' or file == '..'
2070
-
2071
- else
2072
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
2073
- @data['내용설정']['내용'] << [false, file, file_data]
2066
+ on_clicked {
2067
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
2068
+
2069
+ # 경로가 유효한지 확인
2070
+ if Dir.exist?(path)
2071
+ Dir.entries(path).each do |file|
2072
+ if file == '.' or file == '..'
2073
+ next
2074
+ else
2075
+ begin
2076
+ # 파일을 열고 내용을 읽어서 추가
2077
+ file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
2078
+ @data['내용설정']['내용'] << [false, file, file_data]
2079
+ rescue => e
2080
+ # 파일을 열 수 없는 경우, 오류 메시지 출력
2081
+ puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
2082
+ end
2083
+ end
2074
2084
  end
2085
+
2086
+ # 내용 배열에서 마지막 빈 항목 제거
2087
+ @data['내용설정']['내용'] << []
2088
+ @data['내용설정']['내용'].pop
2089
+ else
2090
+ # 경로가 유효하지 않을 경우, 오류 메시지 출력
2091
+ puts "경로가 존재하지 않습니다: #{path}"
2075
2092
  end
2076
- @data['내용설정']['내용'] << []
2077
- @data['내용설정']['내용'].pop
2078
2093
  }
2079
2094
  }
2080
2095
  }
@@ -2166,17 +2181,27 @@ class Wordpress
2166
2181
  }
2167
2182
  button('폴더째로불러오기'){
2168
2183
  stretchy false
2169
- on_clicked{
2184
+ on_clicked {
2170
2185
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
2171
- Dir.entries(@data['이미지설정']['폴더경로'].text.to_s).each do |file|
2172
- if file == '.' or file == '..'
2173
2186
 
2174
- else
2175
- @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
2187
+ # 경로가 유효한지 확인
2188
+ if Dir.exist?(path)
2189
+ Dir.entries(path).each do |file|
2190
+ if file == '.' or file == '..'
2191
+ next
2192
+ else
2193
+ # 폴더 내의 파일을 이미지 리스트에 추가
2194
+ @data['이미지설정']['이미지'] << [false, file, path + "\\" + file.force_encoding('utf-8')]
2195
+ end
2176
2196
  end
2197
+
2198
+ # 마지막 빈 항목 추가 후 제거 (원래 로직에 맞춰)
2199
+ @data['이미지설정']['이미지'] << []
2200
+ @data['이미지설정']['이미지'].pop
2201
+ else
2202
+ # 경로가 존재하지 않으면 경고 메시지 출력
2203
+ puts "경로가 존재하지 않습니다: #{path}"
2177
2204
  end
2178
- @data['이미지설정']['이미지'] << []
2179
- @data['이미지설정']['이미지'].pop
2180
2205
  }
2181
2206
  }
2182
2207
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backlink_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: rnjstnswp123@naver.com