aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstas <stas@FreeBSD.org>2009-02-12 04:18:09 +0800
committerstas <stas@FreeBSD.org>2009-02-12 04:18:09 +0800
commit1d97d6d4c56db65106154bd656b9916eccef4533 (patch)
tree70ce2c19886cb1ef44799a510258886f4e61ac7c
parent9c305554fa53f6855801228f836d22cb49a5b87a (diff)
downloadfreebsd-ports-gnome-1d97d6d4c56db65106154bd656b9916eccef4533.tar.gz
freebsd-ports-gnome-1d97d6d4c56db65106154bd656b9916eccef4533.tar.zst
freebsd-ports-gnome-1d97d6d4c56db65106154bd656b9916eccef4533.zip
- Recode filenames according to user's locale. This allows philesight
to be used with non-POSIX locale filesystems.
-rw-r--r--sysutils/philesight/Makefile6
-rw-r--r--sysutils/philesight/files/patch-philesight.rb40
2 files changed, 44 insertions, 2 deletions
diff --git a/sysutils/philesight/Makefile b/sysutils/philesight/Makefile
index 9c2fafd3154f..fa2c33795254 100644
--- a/sysutils/philesight/Makefile
+++ b/sysutils/philesight/Makefile
@@ -7,7 +7,7 @@
PORTNAME= philesight
PORTVERSION= 20090105
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://zevv.nl/play/code/philesight/
EXTRACT_SUFX= .tgz
@@ -16,7 +16,9 @@ MAINTAINER= stas@FreeBSD.org
COMMENT= Shows a graphics representation of the filesystem usage
RUN_DEPENDS= ${RUBY_SITEARCHLIBDIR}/cairo.so:${PORTSDIR}/graphics/ruby-cairo \
- ${RUBY_SITEARCHLIBDIR}/bdb.so:${PORTSDIR}/databases/ruby-bdb
+ ${RUBY_SITEARCHLIBDIR}/bdb.so:${PORTSDIR}/databases/ruby-bdb \
+ ${RUBY_SITELIBDIR}/locale.rb:${PORTSDIR}/devel/ruby-locale2 \
+ ${RUBY_ARCHLIBDIR}/iconv.so:${PORTSDIR}/converters/ruby-iconv
USE_RUBY= yes
NO_BUILD= yes
diff --git a/sysutils/philesight/files/patch-philesight.rb b/sysutils/philesight/files/patch-philesight.rb
new file mode 100644
index 000000000000..de7411475672
--- /dev/null
+++ b/sysutils/philesight/files/patch-philesight.rb
@@ -0,0 +1,40 @@
+--- philesight.rb.orig 2009-01-05 18:16:40.000000000 +0300
++++ philesight.rb 2009-02-11 22:38:03.000000000 +0300
+@@ -5,6 +5,8 @@
+ require 'cgi'
+ require 'cairo'
+ require 'bdb'
++require 'locale'
++require 'iconv'
+
+ class PNGWriter
+
+@@ -390,6 +392,7 @@
+ #
+
+ def draw_text(cr, x, y, text, size=11, bold=false)
++ conv = Iconv.new("UTF-8", Locale.charset)
+
+ lines = text.count("\n") + 1
+ y -= (lines-1) * (size+2) / 2.0
+@@ -398,11 +401,18 @@
+ cr.set_font_size(size)
+
+ text.split("\n").each do |line|
+- extents = cr.text_extents(line)
++ begin
++ newname = conv.iconv(line)
++ newname << conv.iconv(nil)
++ rescue Iconv::IllegalSequence => e
++ puts "Bad file name: #{line}"
++ next
++ end
++ extents = cr.text_extents(newname)
+ w = extents.width
+ h = extents.height
+ cr.move_to(x - w/2, y + h/2)
+- cr.show_text(line)
++ cr.show_text(newname)
+ y += size+2
+ end
+ end