<commit_before>import bpy
import os
import platform
import sys
import webbrowser
import re
from ..rfb_logger import rfb_log
from .prefs_utils import get_pref

def view_file(file_path):
    
    rman_editor = get_pref('rman_editor', '')

    if rman_editor:
        rman_editor = get_real_path(rman_editor)
        command = rman_editor + " " + file_path
        try:
            os.system(command)
            return
        except Exception:
            rfb_log().error("File or text editor not available. (Check and make sure text editor is in system path.)")        


    if sys.platform == ("win32"):
        try:
            os.startfile(file_path)
            return
        except:
            pass
    else:
        if sys.platform == ("darwin"):
            opener = 'open -t'
        else:
            opener = os.getenv('EDITOR', 'xdg-open')
            opener = os.getenv('VIEW', opener)
        try:
            command = opener + " " + file_path
            os.system(command)
        except Exception as e:
            rfb_log().error("Open file command failed: %s" % command)
            pass
        
    # last resort, try webbrowser
    try:
        webbrowser.open(file_path)
    except Exception as e:
        rfb_log().error("Open file with web browser failed: %s" % str(e))    
<commit_msg>Fix for view_file function. Need to return if we are able to open the file with system builtins.<commit_after>import bpy
import os
import platform
import sys
import webbrowser
import re
from ..rfb_logger import rfb_log
from .prefs_utils import get_pref

def view_file(file_path):
    
    rman_editor = get_pref('rman_editor', '')

    if rman_editor:
        rman_editor = get_real_path(rman_editor)
        command = rman_editor + " " + file_path
        try:
            os.system(command)
            return
        except Exception:
            rfb_log().error("File or text editor not available. (Check and make sure text editor is in system path.)")        


    if sys.platform == ("win32"):
        try:
            os.startfile(file_path)
            return
        except:
            pass
    else:
        if sys.platform == ("darwin"):
            opener = 'open -t'
        else:
            opener = os.getenv('EDITOR', 'xdg-open')
            opener = os.getenv('VIEW', opener)
        try:
            command = opener + " " + file_path
            os.system(command)
            return
        except Exception as e:
            rfb_log().error("Open file command failed: %s" % command)
            pass
        
    # last resort, try webbrowser
    try:
        webbrowser.open(file_path)
    except Exception as e:
        rfb_log().error("Open file with web browser failed: %s" % str(e))    

{'fraction_non_alphanumeric': 0.09230769230769231, 'fraction_numerical': 0.0014652014652014652, 'mean_word_length': 1.883843717001056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3073103', 'n_tokens_mistral': 807, 'n_tokens_neox': 794, 'n_words': 234}